Max Length of Ascending Subsequence
ARRAY
DYNAMIC PROGRAMMING

Problem

Given an array arr of integers, identify the length of the longest subsequence that increases strictly.

A subsequence is defined as a sequence that can be derived from the array by deleting some or no elements without changing the order of the remaining elements.

Examples

findMaxAscendingLength([6, 5, -1, 3, 2, 4, 42, 9]) // returns 4 // Longest ascending subsequence is [-1, 3, 4, 42] // which is of length 4 findMaxAscendingLength([5, 4, 3, 2, 1]) // returns 1
Loading...