Longest Increasing Subsequence

Company: Cisco_AI_Intern__

Difficulty: medium

Problem Statement

Longest Increasing Subsequence Description You are given an array of integers in random order. Your task is to find the length of the longest subsequence in the array such that the elements of the subsequence are in strictly ascending order . A subsequence is a sequence that can be derived from an array by deleting some or no elements without changing the order of the remaining elements. For example, [2, 3, 7] is a subsequence of [10, 9, 2, 5, 3, 7, 101, 18] . Example 1 Input: arr = [10, 9, 2, 5, 3, 7, 101, 18] Output: 4 Explanation: The longest ascending subsequence is [2, 3, 7, 101], which has a length of 4. Example 2 Input: arr = [0, 1, 0, 3, 2, 3] Output: 4 Explanation: The longest ascending subsequence is [0, 1, 2, 3], which has a length of 4.