
DP
徐不依
这个作者很懒,什么都没留下…
展开
-
139. Word Break (DP)
Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words.Note:The ...原创 2019-01-12 19:34:22 · 176 阅读 · 0 评论 -
96. Unique Binary Search Trees && 95. Unique Binary Search Trees II(DP)
96. Unique Binary Search TreesGiven n, how many structurally unique BST's (binary search trees) that store values 1 ... n?Example:Input: 3Output: 5Explanation:Given n = 3, there are a total ...原创 2019-01-12 21:15:35 · 1398 阅读 · 0 评论 -
72. Edit Distance (DP)
Given two words word1 and word2, find the minimum number of operations required to convert word1 to word2.You have the following 3 operations permitted on a word:Insert a character Delete a chara...原创 2019-01-13 12:50:26 · 286 阅读 · 0 评论 -
343. Integer Break
Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get.Example 1:Input: 2Output: 1...原创 2019-01-13 21:12:21 · 118 阅读 · 0 评论 -
120. Triangle (DP)
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], [6,5...原创 2019-01-15 22:38:36 · 141 阅读 · 0 评论 -
20. Valid Parentheses && 32. Longest Valid Parentheses (String, Stack, DP)
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type of b...原创 2019-01-23 11:05:17 · 311 阅读 · 0 评论 -
279. Perfect Squares (DFS, DP)
https://leetcode.com/problems/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.Example 1:Input: n = 12...原创 2019-06-25 22:38:22 · 207 阅读 · 0 评论