![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Dynamic Programming
文章平均质量分 79
Yingying_code
这个作者很懒,什么都没留下…
展开
-
446. Arithmetic Slices II - Subsequence***
A sequence of numbers is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same. For example, these are arithmetic sequen原创 2016-12-11 12:43:38 · 219 阅读 · 0 评论 -
486. Predict the Winner**
Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a player picks a原创 2017-01-30 20:44:05 · 671 阅读 · 0 评论 -
464. Can I Win**
In the "100 game," two players take turns adding, to a running total, any integer from 1..10. The player who first causes the running total to reach or exceed 100 wins. What if we change the game s原创 2017-01-30 23:23:17 · 385 阅读 · 0 评论 -
241. Different Ways to Add Parentheses**
Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *. Example 1原创 2017-01-31 16:57:57 · 234 阅读 · 0 评论 -
304. Range Sum Query 2D - Immutable**
Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2). The above rectangle (with the red bo原创 2017-02-01 11:32:59 · 177 阅读 · 0 评论 -
307. Range Sum Query - Mutable**
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. The update(i, val) function modifies nums by updating the element at index i to val. Examp原创 2017-02-01 12:33:22 · 283 阅读 · 0 评论 -
309. Best Time to Buy and Sell Stock with Cooldown**
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy on原创 2017-02-01 13:41:43 · 250 阅读 · 0 评论 -
213. House Robber II**
Note: This is an extension of House Robber. After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time原创 2017-02-01 13:53:24 · 213 阅读 · 0 评论 -
337. House Robber III**
The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each house has one and only one parent house. After a tour原创 2017-02-01 14:20:20 · 216 阅读 · 0 评论 -
446. Arithmetic Slices II - Subsequence***
A sequence of numbers is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same. For example, these are arithmetic sequen原创 2017-02-25 20:15:40 · 372 阅读 · 0 评论 -
375. Guess Number Higher or Lower II**
We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wrong, I'll tell you whether the number I pi原创 2017-01-30 20:06:35 · 248 阅读 · 0 评论 -
95. Unique Binary Search Trees II
Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example, Given n = 3, your program should return all 5 unique BST's shown below. 1原创 2017-02-01 21:57:10 · 191 阅读 · 0 评论 -
357. Count Numbers with Unique Digits**
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x n. Example: Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x [11,22,33,44,原创 2016-12-11 13:16:34 · 255 阅读 · 0 评论 -
392. Is Subsequence**
Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) strin原创 2016-12-11 14:08:37 · 226 阅读 · 0 评论 -
377. Combination Sum IV**
Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target. Example: nums = [1, 2, 3] target = 4 The pos原创 2016-12-11 16:39:33 · 186 阅读 · 0 评论 -
96. Unique Binary Search Trees**
Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example, Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1原创 2016-12-11 17:06:44 · 177 阅读 · 0 评论 -
309. Best Time to Buy and Sell Stock with Cooldown**
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy on原创 2016-12-11 19:10:08 · 163 阅读 · 0 评论 -
53. Maximum Subarray**
Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1]原创 2016-12-11 19:32:07 · 184 阅读 · 0 评论 -
300. Longest Increasing Subsequence**
Given an unsorted array of integers, find the length of longest increasing subsequence. For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The longest increasing subsequence is [2, 3, 7, 101], ther原创 2016-12-11 21:17:35 · 238 阅读 · 0 评论 -
279. Perfect Squares**
Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. For example, given n = 12, return 3 because 12 = 4 + 4 + 4; given n =原创 2016-12-11 21:58:27 · 240 阅读 · 0 评论 -
120. Triangle**
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [ [2], [3,4], [原创 2017-01-15 18:48:46 · 216 阅读 · 0 评论 -
413. Arithmetic Slices**
A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same. For example, these are arithmetic sequenc原创 2016-12-11 12:05:10 · 180 阅读 · 0 评论