Interesting Watch Sequence

Problem Overview

  • Determine the minimum number of videos to discard so the remaining sequence is coherent.
  • Input: array videoRatings (n unique integers in watch order). Output: minimal removals; the kept videos form a subsequence in the same order.
  • A sequence is coherent if removing at most one video makes its ratings strictly increasing.
  • From TikTok interviews: a coding interview problem modeling feed curation; a common interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: