FastPrepMost Movie Screenings on One Screen
Problems/Most Movie Screenings on One Screen

Most Movie Screenings on One Screen

Adobe logoAdobe● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: You pick the most movies that one screen can show. Each movie has a fixed start hour and a length, and the time ranges must not overlap. An Adobe Computer Scientist 2 report from Noida (June 2024) gives this as the second of two coding questions in its first round. The author is an engineer with 8.5 years of experience. The report gives two arrays, the movie lengths and the hours they should start, and asks for a Java function that maximizes the screenings. It gives no expected answer, limits or overlap rule.

We chose these rules. There is one screen. A movie must start exactly at its given hour. Back-to-back screenings are allowed. There are up to 5000 movies, with lengths up to 10^9 and start hours up to 2 x 10^9, so end times need 64 bits. You can use any of five languages instead of Java. We wrote new visible examples, and the report's own arrays are one of the hidden tests.

Our version is about 75% the same as the reported question.

A cinema has one screen and a list of movies. Movie i lasts movieLength[i] hours and, if it is shown, must start at hour screeningTime[i], so it uses the screen during [screeningTime[i], screeningTime[i] + movieLength[i]).

Two screenings cannot overlap, but one may start at the exact hour the previous one ends. Return the largest number of movies that can be shown.

Function

maxScreenings(movieLength: int[], screeningTime: int[]) → int

Examples

Example 1

movieLength = [3,1,2,2,1]screeningTime = [0,1,2,4,3]return = 3

The movies run during [0, 3), [1, 2), [2, 4), [4, 6) and [3, 4). Showing [1, 2), [2, 4) and [4, 6) back to back gives 3 screenings. Four is impossible: [0, 3) overlaps [1, 2) and [2, 4), and [2, 4) overlaps [3, 4), so at most three of the five fit together.

Example 2

movieLength = [5,1,1]screeningTime = [0,1,3]return = 2

The long movie [0, 5) overlaps both short ones. Skipping it and showing [1, 2) and [3, 4) gives 2.

Example 3

movieLength = [2,2]screeningTime = [7,7]return = 1

Both movies want hours 7 to 9, so only one can be shown.

Constraints

  • 1 <= movieLength.length <= 5000 and screeningTime.length == movieLength.length
  • 1 <= movieLength[i] <= 10^9
  • 0 <= screeningTime[i] <= 2 * 10^9

More Adobe Phone Screen questions

  • Evaluate a Parenthesized Integer ExpressionPHONE SCREEN · Seen Oct 2026
  • All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Binary Tree Level-Order Traversal by LevelsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
  • Count Occurrences in a Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
  • Count Pairs with Absolute Difference KPHONE SCREEN · Seen Jul 2026
  • Count Subsets with Sum KPHONE SCREEN · Seen Jul 2026
  • Numbers with Exactly Three DivisorsPHONE SCREEN · Seen Jul 2026
  • Sum of Even Nodes on a Path in a Numbered Binary TreePHONE SCREEN · Seen Jul 2026
  • Largest Value in Every Sliding WindowPHONE SCREEN · Seen Jul 2026

Similar questions at other companies

  • Minimum Removals for Non-Overlapping IntervalsByteDance · PHONE SCREEN · ONSITE INTERVIEWByteDance interview questions
  • Maximum Number of Events That Can Be AttendedSnowflake · PHONE SCREENSnowflake interview questions
  • Minimum Appointment Cancellations with a Required BreakMaven Clinic · PHONE SCREENMaven Clinic interview questions
  • Minimum Meeting RoomsSentry · PHONE SCREENSentry interview questions
  • Reschedule k Meetings to Find Maximum Break TimeGoogle · PHONE SCREENGoogle interview questions
  • Maximum Compatible Time WindowsIBM · OAIBM interview questions
  • Minimum Railway PlatformsMakeMyTrip.com · ONSITE INTERVIEWMakeMyTrip.com interview questions
  • Task SchedulingJP Morgan Chase · OAJP Morgan Chase interview questions
  • Maximum Non-Overlapping IntervalsMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Minimum Workers with Job AssignmentsLyft · ONSITE INTERVIEWLyft interview questions

Interview reports that mention this question

  • Adobe CS2 and Senior CS Interviews: 6 Experiences (Part 5 of 6)
  • Adobe Experienced Hire Interviews: 55 Experiences (Part 1 of 6)

Adobe interview experiences

  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
  • Adobe New Grad MTS Interview Questions: 7 Experiences
All Adobe interview questionsSee Adobe hiring insights
Saved
class Solution {
    public int maxScreenings(int[] movieLength, int[] screeningTime) {
        // Write your code here.
    }
}
Checking account…