随笔分类 -  dp

1 2 下一页

[leecode]Best Time to Buy and Sell Stock III
摘要:Best Time to Buy and Sell Stock IIISay you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the... 阅读全文

posted @ 2014-08-26 17:20 喵星人与汪星人 阅读(191) 评论(0) 推荐(0) 编辑

[leetcode]Minimum Path Sum
摘要:Minimum Path SumGiven amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along ... 阅读全文

posted @ 2014-08-16 00:58 喵星人与汪星人 阅读(198) 评论(0) 推荐(0) 编辑

[leetcode]Unique Binary Search Trees
摘要:Unique Binary Search TreesGivenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a to... 阅读全文

posted @ 2014-08-16 00:38 喵星人与汪星人 阅读(159) 评论(0) 推荐(0) 编辑

[leetcode]Interleaving String
摘要:Interleaving StringGivens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.For example,Given:s1="aabcc",s2="dbbca",Whens3="aadbbcbcac", r... 阅读全文

posted @ 2014-08-15 21:25 喵星人与汪星人 阅读(393) 评论(0) 推荐(0) 编辑

[leetcode]Maximum Subarray
摘要:Maximum SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−... 阅读全文

posted @ 2014-08-10 19:47 喵星人与汪星人 阅读(202) 评论(0) 推荐(0) 编辑

[leetcode]Unique Paths II
摘要:Unique Paths IIFollow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle an... 阅读全文

posted @ 2014-08-08 22:43 喵星人与汪星人 阅读(191) 评论(0) 推荐(0) 编辑

[leetcode]Unique Paths
摘要:Unique PathsA robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right a... 阅读全文

posted @ 2014-08-08 22:23 喵星人与汪星人 阅读(219) 评论(0) 推荐(0) 编辑

[leetcode]Regular Expression Matching
摘要:Regular Expression MatchingImplement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more o... 阅读全文

posted @ 2014-08-08 16:37 喵星人与汪星人 阅读(368) 评论(0) 推荐(0) 编辑

[leetcode]Trapping Rain Water
摘要:Trapping Rain WaterGivennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to tr... 阅读全文

posted @ 2014-08-08 11:07 喵星人与汪星人 阅读(145) 评论(0) 推荐(0) 编辑

[leetcode]Jump Game II
摘要:Jump Game IIGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents... 阅读全文

posted @ 2014-08-08 00:44 喵星人与汪星人 阅读(246) 评论(0) 推荐(0) 编辑

[leetcode]Jump Game
摘要:Jump GameGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents yo... 阅读全文

posted @ 2014-08-08 00:29 喵星人与汪星人 阅读(247) 评论(0) 推荐(0) 编辑

[leetcode]Palindrome Partitioning II
摘要:Palindrome Partitioning IIGiven a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a p... 阅读全文

posted @ 2014-08-07 19:39 喵星人与汪星人 阅读(244) 评论(0) 推荐(0) 编辑

[leetcode]Best Time to Buy and Sell Stock
摘要:Best Time to Buy and Sell StockSay you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to compl... 阅读全文

posted @ 2014-08-06 22:44 喵星人与汪星人 阅读(126) 评论(0) 推荐(0) 编辑

[leetcode]Word Break
摘要:Word BreakGiven a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.... 阅读全文

posted @ 2014-08-05 01:06 喵星人与汪星人 阅读(630) 评论(0) 推荐(0) 编辑

[leetcode]Decode Ways
摘要:Decode WaysA message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded me... 阅读全文

posted @ 2014-08-03 14:55 喵星人与汪星人 阅读(283) 评论(0) 推荐(0) 编辑

[leetcode]Distinct Subsequences
摘要:Distinct SubsequencesGiven a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is... 阅读全文

posted @ 2014-08-02 02:46 喵星人与汪星人 阅读(338) 评论(0) 推荐(0) 编辑

[leetcode]Longest Valid Parentheses
摘要:Longest Valid ParenthesesGiven a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substr... 阅读全文

posted @ 2014-08-02 02:01 喵星人与汪星人 阅读(1514) 评论(2) 推荐(0) 编辑

[leetcode]Edit distance
摘要:Edit DistanceGiven two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You... 阅读全文

posted @ 2014-08-01 22:36 喵星人与汪星人 阅读(387) 评论(0) 推荐(0) 编辑

[leetcode]Longest Palindromic Substring
摘要:Longest Palindromic SubstringGiven a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there... 阅读全文

posted @ 2014-08-01 00:32 喵星人与汪星人 阅读(288) 评论(0) 推荐(0) 编辑

[leetcode]Climbing Stairs
摘要:Climbing StairsYou are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct way... 阅读全文

posted @ 2014-07-31 23:08 喵星人与汪星人 阅读(187) 评论(0) 推荐(0) 编辑

1 2 下一页