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:...原创 2018-02-15 18:56:52 · 206 阅读 · 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", ...原创 2017-07-26 14:07:35 · 182 阅读 · 0 评论 -
Best_Time_to_Buy_and_Sell_Stock_II
题目描述: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you原创 2017-08-03 12:03:26 · 242 阅读 · 0 评论 -
Best_Time_to_Buy_and_Sell_Stock_I
题目描述: Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one原创 2017-08-04 10:05:01 · 292 阅读 · 0 评论 -
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 suba原创 2017-08-15 15:04:38 · 237 阅读 · 0 评论 -
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 exam原创 2017-08-16 15:31:11 · 308 阅读 · 0 评论 -
Largest_Divisible_Subset
题目描述: Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or Sj % Si = 0. If there原创 2017-08-17 23:00:40 · 264 阅读 · 0 评论 -
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 amo原创 2017-08-21 19:12:43 · 320 阅读 · 0 评论 -
Maximum_Length_of_Pair_Chain
题目描述: You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. Now, we define a pair (c, d) can follow another pair (a, b) if and only if b原创 2017-08-23 16:37:19 · 180 阅读 · 0 评论 -
Shopping_Offers
题目描述: In LeetCode Store, there are some kinds of items to sell. Each item has a price. However, there are some special offers, and a special offer consists of one or more different kinds原创 2017-08-27 11:20:52 · 230 阅读 · 0 评论 -
Unique_Substrings_in_Wraparound_Strin
题目描述: Consider the string s to be the infinite wraparound string of "abcdefghijklmnopqrstuvwxyz", so s will look like this: "...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd....".原创 2017-09-03 18:39:37 · 189 阅读 · 0 评论 -
Palindrome_Partitioning
题目描述:Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.(给定一个字符串S,将s划分为每个子串是回文。返回所有可能的回文划分S.)For example, g原创 2017-09-04 16:51:43 · 245 阅读 · 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原创 2017-09-08 16:28:11 · 298 阅读 · 0 评论 -
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 r原创 2017-09-08 16:30:37 · 234 阅读 · 0 评论 -
Number_of_Longest_Increasing_Subsequence
题目描述:Given an unsorted array of integers, find the number of longest increasing subsequence.Example 1:Input: [1,3,5,4,7]Output: 2Explanation: The two longest increasing subsequence are [1,原创 2017-09-15 19:16:15 · 337 阅读 · 0 评论 -
Best Time to Buy and Sell Stock III
题目描述:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note:You m原创 2017-11-24 21:52:08 · 249 阅读 · 0 评论 -
Create_Maximum_Number
题目描述:Given two arrays of length m and n with digits 0-9 representing two numbers. Create the maximum number of length k <= m + n from digits of the two. The relative order of the digits from the sam原创 2017-12-06 19:02:05 · 162 阅读 · 0 评论 -
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 ex原创 2017-06-18 16:22:07 · 208 阅读 · 0 评论