3176. Find the Maximum Length of a Good Subsequence I
You are given an integer array
nums
and a non-negative integerk
. A sequence of integersseq
is called good if there are at mostk
indicesi
in the range[0, seq.length - 2]
such thatseq[i] != seq[i + 1]
.Return the maximum possible length of a good subsequence of
nums
.
c++
1 |
|