Longest Increasing Subsequence
Start Timer
0:00:00
Write a Python function called longest_increasing_subsequence
that takes a list of integers as input and returns as output the length of the longest increasing subsequence in the list.
Note: An increasing subsequence is a subset of a list where the elements are in strictly increasing order. The subsequence does not have to be contiguous or unique.
Example:
Input:
nums = [10, 9, 2, 5, 3, 3, 7, 101, 18]
Output:
4
Explanation:
The longest increasing subsequence is [2, 3, 7, 101]
, for a total length of 4.
Recommended questions for you
Personalized based on your user activity, skill level, and preferences.
.
.
.
.
.
.
.
.
.
Comments