← Practice · Dynamic programming

Longest Increasing Subsequence Medium

Given an integer array nums, return the length of the longest strictly increasing subsequence (elements need not be contiguous).

Examples

  • [10,9,2,5,3,7,101,18] -> 4 (e.g. [2,3,7,101])
  • [7,7,7,7] -> 1

Define a function named lengthOfLIS in JavaScript.

00:00

JavaScript · Tab indents · Ctrl/⌘+Enter runs the tests