Spring Hire Sale
Limited Time Deal: Unlock all premium questions for over 30% off
$10.42$7.08
08
:
04
:
56
:
38
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. ...