问题来自LeetCode5 用dp来解决比较好理解状态转移方程dp[j][i]表示以j为起点,i为终点的子串是否为回文串dp[j][i] = (s[j] == s[i] && s[j + 1][i - 1])初值当j == i时,dp[j][i] = true当i - j = 1时,s[i] ==...
问题来自LeetCode744 Given a list of sorted characters letters containing only lowercase letters, and given a target letter target, find the smallest element in t...
问题来自LeetCode240 比较取巧的一个方法是选择右上角的元素matrix[i][j]和target作比较,如果比target大,则一定不在最后一列,如果比target下,则一定不在第一行,如果相等,则找到了。 12345678910111213141516171819class Solution ...
问题来自LeetCode300 dp[i]表示以第i位结尾的长度,则状态转移方程dp[i] = max(d[j] + 1) && i > j && nums[i] > nums[j]初值 dp[i] = 1,时间复杂度O(n2) 12345678910111213141...
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 fol...
Given an array nums of integers, you can perform operations on the array. In each operation, you pick any nums[i] and delete it to earn nums[i] points. After...
Given a non-negative integer N, find the largest number that is less than or equal to N with monotone increasing digits. (Recall that an integer has monotone...
Given a list of daily temperatures, produce a list that, for each day in the input, tells you how many days you would have to wait until a warmer temperature...
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: Y...
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is defined ...