← problems
#300

Longest Increasing Subsequence

MediumDynamic Programming

Given an integer array nums, return the length of the longest strictly increasing subsequence.

A subsequence is derived by deleting some or no elements without changing the order of the remaining elements.

Example

nums = [10, 9, 2, 5, 3, 7, 101, 18]  => 4   // [2, 3, 7, 101]
Implement
function LengthOfLIS(nums: int[]) -> int

Found a bug? Or annoyed about something in the language? Tell us.

loading editor…