You are given an integer array nums.
nums
A subsequence sub of nums having length xxx is called valid if:
sub
Now, let’s take a moment to make sure you’ve correctly understood the problem. The quiz below helps you check if you’re solving the correct problem:
Find the Maximum Length of Valid Subsequence I
For the input nums = [5,7,9,11,13], what is the maximum length of a valid subsequence?
nums = [5,7,9,11,13]
(4)
(5)
(3)
(2)
We have a game for you to play. Rearrange the logical building blocks to develop a clearer understanding of how to solve this problem.
Implement your solution in the following coding playground.