July 4th Sale
Limited Time Deal: Unlock all premium questions for over 40% off
$10.42$6.25
10
:
09
:
28
:
08
Back to Dashboard
[OA] Bounded Transition Subsequence
Hard
You are compressing a color run sequence. Given an array of color IDs and an integer k representing the maximum number of allowed color changes, find the length of the longest subsequence such that the number of adjacent pairs with different values is at most k.
A subsequence is formed by selecting elements at any positions (not necessarily contiguous) from the original array while preserving their relative order. ...