Category: dynamic programming
Given a string s, find the longest palindromic subsequence’s length in s. You may assume that the maximum length of s is 1000. Example 1: Input: “bbbab” Output: 4 …
Given a list of positive integers nums and an integer k, return the number of subsets in the list that sum up to k. Mod the result by 10 …
You are given two lists of integers weights and values which have the same length and an integer capacity. weights and values represent the weight and value of the …
A number is called stepping number if all adjacent digits have an absolute difference of 1. For example, 321 is a stepping number while 421 is not. Given an …
Given an unsorted array of integers nums, find the length of the longest sequence of consecutive elements. Constraints n ≤ 100,000 where n is the length of nums Example …