Tag: dynamic programming algorithm
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 …
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 …
You are given a list blocks where each block contains two integers where start < end. You can join two blocks if the end of one is equal to …
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 …