Maximize Ratings

Problem Overview

  • Select a subsequence of movies to maximize the sum of ratings, with the rule that you cannot skip more than one movie in a row.
  • Input: integer array ratings[n]; Output: the maximum achievable sum.
  • Constraints: 1 ≤ n ≤ 1e5, ratings[i] ∈ [-1000, 1000].
  • Real-world context: planning a film festival lineup from a rated movie list, keeping order and skip limits.
  • From Akuna interviews; a coding interview problem and frequent 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: