#3176

Find the Maximum Length of a Good Subsequence I

expert · 1125 · lc medium +32 · 32.5% accepted · 167 likes · top 10%

Description

Given an integer array nums and a non-negative integer k, a subsequence is good if the count of consecutive differing-value pairs in it is at most k. Return the maximum length of a good subsequence of nums.

Code

1
2
3