动态规划
文章平均质量分 76
likecool21
这个作者很懒,什么都没留下…
展开
-
LeetCode刷题笔录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 operations permitted on a word:原创 2014-04-30 12:34:42 · 1219 阅读 · 0 评论 -
LeetCode刷提笔录Scramble String
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = "great": great / \ gr原创 2014-12-18 07:05:53 · 836 阅读 · 0 评论 -
LeetCode刷题笔录Interleaving String
Given s1, s2, s3, find whethers3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = "aadbbcbcac", return true.When s3 = "aadbbbaccc", return原创 2014-12-16 06:46:06 · 670 阅读 · 0 评论 -
LeetCode刷题笔录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.这题要用到原创 2014-11-14 13:29:45 · 733 阅读 · 0 评论 -
LeetCode刷题笔录Distinct Subsequences
Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the original string by deleting some (can be non原创 2014-09-03 05:03:55 · 519 阅读 · 0 评论 -
LeetCode刷题笔录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, givens = "leetcode",dict = ["leet"原创 2014-08-06 05:34:00 · 586 阅读 · 0 评论 -
LeetCode刷题笔录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], [原创 2014-08-02 02:19:28 · 588 阅读 · 0 评论 -
LeetCode刷题笔录Minimum Path Sum
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at原创 2014-07-04 05:56:28 · 533 阅读 · 0 评论 -
LeetCode刷题笔录Unique Paths II
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 respectively in the原创 2014-07-21 05:08:44 · 581 阅读 · 0 评论 -
LeetCode刷题笔录Unique Binary Search Trees
这里有个讲解(印度人口音真难懂)原创 2014-04-27 13:33:30 · 945 阅读 · 0 评论 -
LeetCode刷题笔录 Jump Game II
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal i原创 2014-04-11 13:39:09 · 1279 阅读 · 0 评论 -
LeetCode刷题笔录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] ha原创 2014-05-09 06:21:52 · 693 阅读 · 0 评论 -
LeetCode刷题笔录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?原创 2014-05-03 23:37:15 · 720 阅读 · 0 评论 -
LeetCode刷题笔录dungeon game
The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially p原创 2015-01-08 04:27:02 · 6013 阅读 · 0 评论