![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
动态规划
文章平均质量分 78
xuchenhuics
这个作者很懒,什么都没留下…
展开
-
152. Maximum Product Subarray
152. Maximum Product Subarray原创 2021-05-30 12:57:37 · 132 阅读 · 0 评论 -
72. Edit Distance
Given two stringsword1andword2, returnthe minimum number of operations required to convertword1toword2.You have the following three operations permitted on a word:Insert a character Delete a character Replace a characterExample 1:Input:...原创 2021-05-29 18:34:28 · 176 阅读 · 0 评论 -
516. Longest Palindromic Subsequence
516. Longest Palindromic SubsequenceGiven a strings, findthe longest palindromicsubsequence's length ins.Asubsequenceis a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaini...原创 2021-05-03 17:34:29 · 154 阅读 · 0 评论 -
576. Out of Boundary Paths
576. Out of Boundary PathsThere is anmbyngrid with a ball. Given the start coordinate(i,j)of the ball, you can move the ball toadjacentcell or cross the grid boundary in four directions (up, down, left, right). However, you canat mostmoveNtim...转载 2020-08-13 01:03:03 · 113 阅读 · 0 评论 -
132. Palindrome Partitioning II
132. Palindrome Partitioning II[LeetCode] Palindrome Partitioning II 拆分回文串之二Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs.Example:...转载 2020-07-18 22:46:01 · 116 阅读 · 0 评论 -
55. Jump Game
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.Determine if you are able to reach the last index.Example 1:Inp.转载 2020-07-04 12:41:30 · 112 阅读 · 0 评论 -
39. Combination Sum
Given asetof candidate numbers (candidates)(without duplicates)and a target number (target), find all unique combinations incandidateswhere the candidate numbers sums totarget.Thesamerepeated number may be chosen fromcandidatesunlimited number...转载 2020-07-04 09:38:13 · 142 阅读 · 0 评论 -
647. Palindromic Substrings
Given a string, your task is to count how many palindromic substrings in this string.The substrings with different start indexes or end indexes are counted as different substrings even they consist ...转载 2020-04-21 00:23:36 · 119 阅读 · 0 评论 -
494. Target Sum
You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols+and-. For each integer, you should choose one from+and-as its new symbol.Find out how m...转载 2020-04-19 23:54:25 · 113 阅读 · 0 评论 -
[LeetCode] 416. Partition Equal Subset Sum
Given anon-emptyarray containingonly positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.Note:Each of the array eleme...转载 2020-04-19 23:24:38 · 111 阅读 · 0 评论 -
139. Word Break
Given anon-emptystringsand a dictionarywordDictcontaining a list ofnon-emptywords, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.Note:The ...转载 2020-04-12 21:21:34 · 181 阅读 · 0 评论 -
Leetcode 120. 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], [6,5...原创 2020-01-05 16:10:36 · 135 阅读 · 0 评论 -
Leetcode 343. Integer Break
Given a positive integern, break it into the sum ofat leasttwo positive integers and maximize the product of those integers. Return the maximum product you can get.Example 1:Input: 2Output: 1...原创 2020-01-10 08:20:06 · 131 阅读 · 0 评论 -
Leetcode 64. Minimum Path Sum
Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note:You can only move either down or right at a...原创 2020-01-05 18:06:19 · 126 阅读 · 0 评论 -
322. Coin Change
322. Coin ChangeYou are given coins of different denominations and a total amount of moneyamount. Write a function to compute the fewest number of coins that you need to make up that amount. If tha...转载 2020-03-08 18:38:06 · 98 阅读 · 0 评论 -
硬币面值组合问题
转自:https://www.cnblogs.com/python27/p/3303721.html问题描述 假设我们有8种不同面值的硬币{1,2,5,10,20,50,100,200},用这些硬币组合够成一个给定的数值n。例如n=200,那么一种可能的组合方式为 200 = 3 * 1 + 1*2 + 1*5 + 2*20 + 1 * 50 + 1 * 100. 问总过有多少种可能的组...转载 2020-03-08 16:11:32 · 1072 阅读 · 0 评论 -
LeetCode-DP算法 | 最长公共子序列和最长公共子串区别
转自:https://blog.csdn.net/u012426298/article/details/82796660最长公共子串(Longest Common Substring)与最长公共子序列(Longest Common Subsequence)的区别: 子串要求在原字符串中是连续的,而子序列则只需保持相对顺序一致,并不要求连续。例如X = {a, Q, 1, 1}; Y = {a,...转载 2020-03-08 13:55:33 · 260 阅读 · 0 评论 -
279. Perfect Squares
Given a positive integern, find the least number of perfect square numbers (for example,1, 4, 9, 16, ...) which sum ton.Example 1:Input: n = 12Output: 3 Explanation: 12 = 4 + 4 + 4.Example...原创 2020-01-11 11:55:34 · 187 阅读 · 0 评论 -
Leetcode 309. Best Time to Buy and Sell Stock with Cooldown
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one ...原创 2020-01-15 00:05:07 · 115 阅读 · 0 评论 -
Leetcode 121. Best Time to Buy and Sell Stock I II
Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the stock),...原创 2020-01-12 21:48:31 · 132 阅读 · 0 评论 -
Leetcode 198. House Robber I II III
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 house...原创 2020-01-12 09:11:44 · 196 阅读 · 0 评论 -
Leetcode 91. Decode Ways
A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given anon-emptystring containing only digits, determine t...原创 2020-01-11 18:06:36 · 159 阅读 · 0 评论