
LeetCode
Sodaoo
Deep Inner Peace
展开
-
LeetCode(5)
动态规划什么是动态规划?一、基本概念动态规划过程是:每次决策依赖于当前状态,又随即引起状态的转移。一个决策序列就是在变化的状态中产生出来的,所以,这种多阶段最优化决策解决问题的过程就称为动态规划。二、基本思想与策略基本思想与分治法类似: 待求解的问题分解为若干个子问题(阶段),按顺序求解子阶段,前一子问题的解,为后一子问题的求解提供了有用的信息。在求解任一子问题时,列出各种可能的局部解,通过决策 保原创 2017-11-17 18:00:43 · 708 阅读 · 0 评论 -
最长回文子序列
Description : 寻找字符串的最长回文子序列的长度 . 和子串不同,子串要求是连续的, 但是回文序列可以不连续 比如 “axbnOba” 的最长回文子序列就是 “abOba” ,长度为 5 . 子问题 : 单字符一定是回文序列 . 对任意字符串,如果头和尾相同,那么它的最长回文子序列一定是: “去头尾后的部分的最长回文子序列 + 头和尾 “。 如果头和尾不同,那么它原创 2017-11-18 13:44:12 · 427 阅读 · 0 评论 -
LeetCode(6)
.原创 2017-11-18 16:16:04 · 408 阅读 · 0 评论 -
LeetCode(4)
Description : There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Exam原创 2017-11-16 22:11:10 · 325 阅读 · 0 评论 -
LeetCode(14)
Description : Write a function to find the longest common prefix string amongst an array of strings. for example: “abcjkf” , “abcowi” ,”abcR” ,the longest common prefix string is “abc” if N原创 2017-11-22 14:00:38 · 454 阅读 · 0 评论 -
LeetCode(15) 3Sum
Description : An array S of n integers .are there elements a, b, c in S such that a+b+c=0 ? Find all unique triplets in the array which gives the sum of zero. Note: The solution set must not c原创 2017-11-22 18:32:30 · 351 阅读 · 0 评论 -
LeetCode(16) 3Sum Closest
https://sodaoo.github.io/2017/11/21/LeetCode-16/ https://sodaoo.github.io来我的网站查看更多 LeetCode 题解 Description : Given an array S of n integers, find three integers in S such that the sum is closest原创 2017-11-23 11:38:38 · 469 阅读 · 0 评论