DP
周大侠
这个作者很懒,什么都没留下…
展开
-
[LeetCode] Maximal Rectangle(!!!DP)
关于最大某某问题,使用DP思想来求解,在最大子问题系列中有较为详细的解答。 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. (实在不能理解为什么要用char)c原创 2015-08-27 16:08:06 · 564 阅读 · 0 评论 -
[LeetCode]Climbing Stairs
Climbing Stairs You 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?基础的DP,到达原创 2015-08-23 00:49:14 · 270 阅读 · 0 评论 -
[LeetCode] Maximal Square(!!!!DP优化)
定义一个D[i][j] 表示的是以i,j为右下角的最大子正方形的边长。这个边长是受限于D[i-1][j],D[i][j-1] ,D[i-1][j-1]中最小的那个的。class Solution {public: int maximalSquare(vector<vector<char>>& A) { int m = A.size(); if(m==0) retu原创 2015-08-27 20:13:28 · 346 阅读 · 0 评论 -
[LeetCode] Edit Distance(!!!!!DP)
Edit Distance Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You have the following 3 opera原创 2015-08-27 11:13:30 · 320 阅读 · 0 评论 -
[LeetCode]Longest Valid Parentheses(!!!)
Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring. For “(()”, the longest valid parentheses substring is “()”,原创 2015-07-14 22:54:55 · 333 阅读 · 0 评论 -
[LeetCode] Unique Binary Search Trees(!!DP)
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原创 2015-09-27 13:38:08 · 256 阅读 · 0 评论 -
[LeetCode] Decode Ways(!!!DP)
Decode Ways My Submissions Question Solution Total Accepted: 47576 Total Submissions: 290697 Difficulty: Medium A message containing letters from A-Z is being encoded to numbers using the follow原创 2015-09-16 13:24:11 · 314 阅读 · 0 评论