Binge Watching
Updated
Problem statement
You are given the durations of n movies in durations. You can watch at most 3.00 time units per day.
Watch every movie from beginning to end on one day; a movie cannot be split across days. You may choose any viewing order and place multiple movies on a day when their total duration is at most 3.00.
Return the minimum number of days needed to watch all movies.
Function
findMinimumDays(durations: float[]) → intExamples
Example 1
durations = [1.9,1.04,1.25,2.5,1.75]return = 3One schedule is [1.90,1.04], [2.50], and [1.25,1.75]. At most two movies fit per day because every movie lasts at least 1.01, so five movies need at least three days.
Example 2
durations = [1.01,1.99]return = 1The two whole movies total exactly 3.00, so one day is sufficient.
Constraints
1 <= durations.length <= 1000.1.01 <= durations[i] <= 3.00.- Durations have at most two digits after the decimal point.
More Vanguard Online Assessment questions
- Two SumOA · Seen Sep 2026
- Valid ParenthesesOA · Seen Sep 2026
- Are They PangramsOA · Seen Nov 2025
- Missing WordsOA · Seen Nov 2025
- Spam DetectionOA · Seen Nov 2025
- Minimum Moves Around a Circular ArrayOA · Seen Aug 2022
- Maximum Occurring CharacterOA · Seen Mar 2022
- Picking TicketsOA · Seen Mar 2022
- Tool List: Two Smallest ValuesOA · Seen Nov 2021
- Group AnagramsOA · Seen Nov 2019
Similar questions at other companies
- Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- Can Every Package Fit in a BoxIMC Trading · OAIMC Trading interview questions
- Minimum Tunnel Crossing TimeArcesium · OAArcesium interview questions
- Get Maximum PairsAmazon · OA
- Find Maximum GreatnessTwilio · OATwilio interview questions
- Maximum Easy Tasks After RearrangingIBM · OAIBM interview questions
- Latest Arrival to Catch a BusAutodesk · OAAutodesk interview questions
- Minimum Removals to Balance ArraySalesforce · OASalesforce interview questions
- Minimum Machines for TasksExpedia · OAExpedia interview questions
- Find Minimum Possible SizeMathWorks · OAMathWorks interview questions