
动态规划问题
!&?
这个作者很懒,什么都没留下…
展开
-
LeetCode——53. Maximum Subarray
题目描述Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.Example:Input: [-2,1,-3,4,-1,2,1,-5,4],Output: 6Explana...原创 2019-03-15 11:06:02 · 145 阅读 · 0 评论 -
LeetCode——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?Note: Given n ...原创 2019-01-09 18:28:13 · 233 阅读 · 0 评论 -
LeetCode——746. Min Cost Climbing Stairs
On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed).Once you pay the cost, you can either climb one or two steps. You need to find minimum cost to reach the top of t...原创 2019-01-09 18:14:19 · 120 阅读 · 0 评论 -
LeetCode——121. Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the stock), ...原创 2019-01-08 20:53:41 · 122 阅读 · 0 评论 -
LeetCode——198. 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 adjacent ...原创 2019-03-15 12:24:59 · 119 阅读 · 0 评论 -
LeetCode——303. Range Sum Query - Immutable
题目描述Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1sumRange(2, 5) -> -1su...原创 2019-03-15 12:41:00 · 163 阅读 · 0 评论 -
LeetCode——338. Counting Bits
题目描述Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and return them as an array.Example 1:Input: 2O...原创 2019-03-15 15:51:31 · 142 阅读 · 0 评论