Tag: dynamic programming
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 …
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 …
Teaching Kids Programming: Videos on Data Structures and Algorithms The Pascal Triangle looks like this: Each number is equal to the two numbers above it. Two edges are filled …
Given an integer n, return the nth (0-indexed) row of Pascal’s triangle. Pascal’s triangle can be created as follows: In the top row, there is an array of 1. …
Given 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 = …