Problem 3176 · Medium

Find the Maximum Length of a Good Subsequence I

A subsequence is good when at most k neighbours differ; a table indexed by end position and changes used finds the longest one.

Open the interactive visualisation