An Evening of Movies

Problem Overview

  • Determine the maximum number of movies where each runtime equals or is exactly one minute longer than the previous; no repeats; first can be any length.
  • Input: int[] runtimes; Output: int for longest valid sequence; return 0 if no marathon possible.
  • Context: planning a movie marathon from a film library, progressing from shorter to longer durations.
  • From Akuna interviews; a coding interview problem and 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: