![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
海州湾
这个作者很懒,什么都没留下…
展开
-
Leetcode#53 Maximum Subarray
转载出处http://www.cnblogs.com/boring09/p/4252780.html方法I:动态规划另sum[i]表示从i开始的最大子串和,则有递推公式:sum[i] = max{A[i], A[i] + sum[i+1]}因为递推式只用到了后一项,所以在编码实现的时候可以进行状态压缩,用一个变量即可代码: int maxSubArray(int A[]转载 2017-07-11 13:49:41 · 149 阅读 · 0 评论 -
LeetCode 数字排列问题 46 Permutations
题目链接https://leetcode.com/problems/permutations/#/descriptionGiven a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations原创 2017-07-18 16:18:56 · 172 阅读 · 0 评论 -
LeetCode 树序列化与反序列化[递归]297. Serialize and Deserialize Binary Tree
题目链接https://leetcode.com/problems/serialize-and-deserialize-binary-tree/#/descriptionSerialization is the process of converting a data structure or object into a sequence of bits so that it原创 2017-07-17 10:38:20 · 322 阅读 · 0 评论 -
LeetCode 198. [DP]House Robber
题目链接You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjace原创 2017-07-14 10:58:03 · 190 阅读 · 0 评论 -
LeetCode [DP]70. Climbing Stairs
70. Climbing StairsYou are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Not原创 2017-07-14 09:07:35 · 185 阅读 · 0 评论 -
LeetCode [DP]322. Coin Change
题目链接ou are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount原创 2017-07-14 18:00:21 · 169 阅读 · 0 评论 -
LeetCode 606.[DFS] Construct String from Binary Tree
题目位置https://leetcode.com/problems/construct-string-from-binary-tree/#/descriptionC++代码DFS string类型class Solution {public: string dfs(TreeNode *t){ string str = ""; //if原创 2017-07-13 17:44:15 · 210 阅读 · 0 评论 -
LeetCode[递归]53. Maximum Subarray 数组最大和
题目链接https://leetcode.com/problems/maximum-subarray/#/descriptionFind the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given原创 2017-07-19 11:40:05 · 212 阅读 · 0 评论