![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetCode-dp
文章平均质量分 79
iteye_9192
这个作者很懒,什么都没留下…
展开
-
子矩阵问题
矩阵中的最大正方形子矩阵(Maximal Square) 题目描述:1 0 1 0 01 0 1 1 11 1 1 1 11 0 0 1 0 比如说,在这个矩阵中,由1构成的最大正方形子矩阵就是4. 题目分析: matrix[ ][ ] 用来存放01,那么当求矩阵[i][j] 的最大矩阵时,用一个 max存放正方形的边长 如果[i]...原创 2015-06-10 15:38:52 · 293 阅读 · 0 评论 -
Wildcard Matching
'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).The matching should cover the entire input string (not partial).The function prototype...原创 2015-04-29 14:30:22 · 72 阅读 · 0 评论 -
leetcode Stock买 and 卖
在数组中求最大的差值 最大的差值和 两对差值最大 k对差值最大 第一种类型 ; 买进一次 卖出一次 , 求最大差价 ; 思路 : 求P(n) , 可以利用P(n-1)结果,但是 prices[n] 可能小于 前面的最大值或者大于最大值可以通过一个变量记录前面的最小值所在小标,不要关心最大值,求P(n)时,就拿prices[n]与最小值比较 ; if ...原创 2015-04-27 23:09:47 · 113 阅读 · 0 评论 -
关于连续子数组的最大和和最大积
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] ...原创 2015-04-23 19:43:36 · 124 阅读 · 0 评论 -
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 th...原创 2015-04-23 16:07:26 · 69 阅读 · 0 评论 -
Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach th...原创 2015-04-22 13:03:06 · 73 阅读 · 0 评论 -
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? 题目意思 : n步到达,每次可以走一步或两步 , 有多少...原创 2015-04-22 11:21:06 · 94 阅读 · 0 评论 -
word break
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. For example, given s = "leetcode", dict = ["leet"...原创 2015-04-20 11:21:38 · 72 阅读 · 0 评论 -
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 ...原创 2015-04-07 14:12:27 · 133 阅读 · 0 评论 -
unique Binary Tree
第一种 : 给定一个数值 n 求它能构成的不同的BST的个数: 这类题,很像那个求斐波那契和,关键就是把状态记录 通过一个数组 把 1 到 i 的BST数目记录 , : 范围大小相等,那么BST的数目一样,接下来就可以直接利用了!public class Solution { public int numTrees(int n) { int[] num ...原创 2015-04-30 14:42:22 · 91 阅读 · 0 评论