Problem · Dynamic Programming

Cinema Shows

MediumAmazonFULLTIMEOA
See Amazon hiring insights

SDE II

A prominent media company (AMZ MGM) 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.

Function Description

Complete the function cinemaShows in the editor below.

cinemaShows has the following parameter(s):

  1. int start[n]: an integer array denoting the start times of each show
  2. int duration[n]: an integer array denoting the durations of each show
  3. int volume[n]: an integer array denoting the volumes of each show

Returns

int: an integer denoting the maximum possible volume that can be received

Examples
01 · Example 1
start = [10, 5, 15, 18, 30]
duration = [20, 12, 20, 35, 35]
volume = [50, 51, 20, 25, 10]
return = 76
Example 1 illustration
02 · Example 2
start = [1, 2, 4]
duration = [2, 2, 1]
volume = [1, 2, 3]
return = 4
Will udpate once find more reliable resources :) As always 🐳
Constraints
  • 1 ≤ n ≤ 10^5
  • 1 ≤ start[i] ≤ 10^9
  • 1 ≤ duration[i] ≤ 10^9
  • 1 ≤ volume[i] ≤ 10^3
More Amazon problems
drafts saved locally
public int cinemaShows(int[] start, int[] duration, int[] volume) {
  // write your code here
}
start[10, 5, 15, 18, 30]
duration[20, 12, 20, 35, 35]
volume[50, 51, 20, 25, 10]
expected76
sign in to submit