
LeetCode—dp
ZQYnn~
这个人很神秘,什么都没有写~
展开
-
LeetCode 5.Longest Palindromic Substring
Longest Palindromic SubstringGiven a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example 1:Input: "babad"Output: "bab"Note: "aba" i...原创 2019-10-30 23:01:10 · 143 阅读 · 0 评论 -
LeetCode 1143.Longest Common Subsequence
Longest Common SubsequenceGiven two strings text1 and text2, return the length of their longest common subsequence.A subsequence of a string is a new string generated from the original string with ...原创 2019-10-20 22:42:27 · 202 阅读 · 0 评论 -
LeetCode 53. Maximum Subarray
53. Maximum SubarrayGiven an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.Example:Input: [-2,1,-3,4,-1,2,1,-5,4],...原创 2019-10-18 12:16:45 · 116 阅读 · 0 评论 -
LeetCode 198.House Robber
House RobberYou 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 a...原创 2019-07-24 12:15:18 · 199 阅读 · 0 评论 -
LeetCode 174.Dungeon Game
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) w...原创 2019-10-01 08:32:17 · 244 阅读 · 0 评论 -
LeetCode 64.Minimum Path Sum
Minimum Path SumGiven 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 ...原创 2019-09-29 12:23:46 · 158 阅读 · 0 评论 -
LeetCode 63.Unique Paths II
Unique Paths IIA 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...原创 2019-09-29 12:18:19 · 167 阅读 · 0 评论 -
LeetCode 62.Unique Paths
Unique PathsA 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...原创 2019-09-29 07:49:50 · 215 阅读 · 0 评论 -
LeetCode 300.Longest Increasing Subsequence
Longest Increasing SubsequenceGiven an unsorted array of integers, find the length of longest increasing subsequence.Example:Input: [10,9,2,5,3,7,101,18]Output: 4 Explanation: The longest incre...原创 2019-09-27 11:02:43 · 133 阅读 · 0 评论 -
LeetCode 279.Perfect Squares
Perfect SquaresGiven a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n.Example 1:Input: n = 12Output: 3 Explanation: 12 = 4 +...原创 2019-09-27 11:00:07 · 122 阅读 · 0 评论 -
LeetCode 70. Climbing Stairs
Climbing StairsYou 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?Note: Given n will...原创 2019-09-14 12:29:31 · 174 阅读 · 0 评论 -
LeetCode 509. Fibonacci Number
Fibonacci NumberThe Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That ...原创 2019-09-14 12:09:41 · 156 阅读 · 0 评论 -
LeetCode 118. Pascal's Triangle
Pascal's TriangleGiven a non-negative integer numRows, generate the first numRows of Pascal’s triangle.In Pascal’s triangle, each number is the sum of the two numbers directly above it.Example:...原创 2019-09-14 11:33:52 · 197 阅读 · 0 评论