![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Dynamic Programming
文章平均质量分 74
伊萨卡钢琴家
这个作者很懒,什么都没留下…
展开
-
Leetcode 63. Unique Paths II
question:Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respect原创 2016-01-23 14:03:28 · 238 阅读 · 0 评论 -
Leetcode 90. Subsets II
iven a collection of integers that might contain duplicates, nums, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain dup原创 2016-01-31 03:46:44 · 278 阅读 · 0 评论 -
Leetcode 78. Subsets
Given a set of distinct integers, nums, return all possible subsets.Analysis, just to use the former result and then add some elements to the result set.public class Solution { public List>原创 2016-01-23 14:37:30 · 207 阅读 · 0 评论 -
Leetcode 322. Coin Change
You 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 of money原创 2016-02-07 13:49:48 · 356 阅读 · 0 评论 -
Leetcode 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], [原创 2016-01-28 04:25:57 · 214 阅读 · 0 评论 -
Leetcode 85. Maximal Rectangle
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.Analysis:需要结合Stack,进行压栈和出栈等操作。最有技巧的一点就是利用Dynamic Programming, 统计在二维数组中连续一的个数。然后原创 2016-01-25 12:38:49 · 209 阅读 · 0 评论 -
Leetcode 155. Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get原创 2016-01-25 12:03:51 · 262 阅读 · 0 评论 -
Leetcode 204. Count Primes
Description:Count the number of prime numbers less than a non-negative number, n.这个题有考数学的感觉,使用dynamic programming 应该是一种比较好的解法,从2开始,依次将prime number 的倍数置为不是prime number.对于prime number 不置,因为当原创 2016-01-25 06:30:53 · 254 阅读 · 0 评论 -
Leetcode Dynamic Programming 题型总结
简单的利用一个数 或者几个数进行Dynamic programming121. Best Time to Buy and Sell Stock https://leetcode.com/problems/best-time-to-buy-and-sell-stock/70. Climbing Stairs https://leetcode.com/problems/climbing-原创 2016-01-24 11:57:34 · 637 阅读 · 0 评论 -
Leetcode 42. Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,2,1,0,1,3,2,1,2,1]原创 2016-01-23 14:26:28 · 214 阅读 · 0 评论 -
Leetcode 91. Decode Ways
A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the total nu原创 2016-01-31 09:15:22 · 477 阅读 · 0 评论