Optimal Screening Schedule

Optimal Screening Schedule

A prominent media company has partnered with select theaters to showcase exclusive video content, including feature films, episodic series, live performances, and more.
You are given an integer n, representing the number of scheduled screenings. Each screening has a start time, duration, and expected audience size, which are provided as integer arrays start, duration, and volume, respectively.
Your task is to determine the highest possible total audience size while ensuring that no two selected screenings overlap. Two screenings are considered non-overlapping if one fully concludes before the next one begins.

Input:
int start[n]: an integer array denoting the start times of each show
int duration[n]: an integer array denoting the durations of each show
int volume[n]: an integer array denoting the volumes of each show
Output:
The function should return an integer denoting the maximum possible volume that can be received.

Example1:
Input: start = [10, 5, 15, 18, 30], duration = [30, 12, 20, 35, 35], volume = [50, 51, 20, 25, 10]
Output: 76
Explanation:
The first show will start at time = 10, and last until time = 40.
The second show will start at time = 5, and last until time = 17.
The third show will start at time = 15, and last until time = 35.
The fourth show will start at time = 18, and last until time = 53.
The fifth show will start at time = 30, and last until time = 65.
The first show completely overlaps the second and third shows, and partially overlaps the fourth and fifth shows.
Optimally choosing the shows that do not overlap are the 2nd and 4th shows that lead to the total volume of 51 + 25 = 76. This is the maximum total volume possible for non-overlapping shows.
Hence, the answer is 76.
Example2:
Input: start = [1, 2, 4], duration = [2, 2, 1], volume = [1, 2, 3]
Output: 4



Get one-to-one training from Google Facebook engineers

Top-notch Professionals

Learn from Facebook and Google senior engineers interviewed 100+ candidates.
Most recent interview questions and system design topics gathered from aonecode alumnus.
One-to-one online classes. Get feedbacks from real interviewers.

Customized Private Class

Already a coding expert? - Advance straight to hard interview topics of your interest.
New to the ground? - Develop basic coding skills with your own designated mentor.
Days before interview? - Focus on most important problems in target company question bank.