Longest Increasing Subsequence - aloalgo

Longest Increasing Subsequence

Medium

You are given an integer array named nums.

Your task is to determine the length of the longest strictly increasing subsequence within this array.

You may assume that:

  • A subsequence is formed by deleting zero or more elements from the original array while maintaining the relative order of the remaining elements.
  • A strictly increasing subsequence means that each element in the subsequence is greater than the one preceding it.

Return the length of the longest strictly increasing subsequence.

Example 1

Input
[1, 7, 0, 1, 1, 2, 3, 9]
Output
5
Explanation:

The longest increasing subsequence is [0, 1, 2, 3, 9], so the length is 5.

Example 2

Input
[6, 6, 6]
Output
1
Explanation:

The longest increasing subsequence is [6], so the length is 1.

Loading...
Input
[1, 7, 0, 1, 1, 2, 3, 9]
Output
5

Hello! I am your ✨ AI assistant. I can provide you hints, explanations, give feedback on your code, and more. Just ask me anything related to the problem you're working on!