University Career Fair
Updated
Problem statement
A career fair has one presentation stage. Company i arrives at time arrival[i] and its presentation occupies the fixed interval from that time until arrival[i] + duration[i]. You may accept or reject each presentation; you cannot shift its start time or shorten it.
Return the maximum number of nonoverlapping presentations that can be hosted. A presentation may start exactly when another ends. For this exercise, assume both input arrays must remain unchanged.
Function
maxEvents(arrival: int[], duration: int[]) → intExamples
Example 1
arrival = [1,3,3,5,7]duration = [2,2,1,2,1]return = 4Choose the first presentation, either compatible presentation at time 3, then times 5 and 7.
Example 2
arrival = [1,3,5]duration = [2,2,2]return = 3Each next presentation starts when the previous one ends.
Example 3
arrival = [1,2,3]duration = [10,2,1]return = 1Every pair overlaps, so only one can be hosted.
Constraints
1 <= arrival.length = duration.length <= 50.1 <= arrival[i], duration[i] <= 1000.- Only one presentation can occupy the stage at a time; touching endpoints are allowed.
More Roblox Online Assessment questions
- Centered Block Placement QueriesOA · Seen Oct 2026
- Robot Navigation Around LasersOA · Seen Oct 2026
- Factory Batch Profit (Game Adaptation)OA · Seen Sep 2026
- Nested Recipe Blocks (Game Adaptation)OA · Seen Sep 2026
- Vehicle Builds for Required Terrain (Game Adaptation)OA · Seen Sep 2026
- Track Received Byte RangesOA · Seen Sep 2026
- Break a PalindromeOA · Seen Jun 2026
- Count Pairs Differing in One DigitOA · Seen Oct 2025
- Find Zero Cells in a 2×2 GridOA · Seen Oct 2025
- Cat Route Budget Planning (Game Adaptation)OA · Seen Aug 2025
Similar questions at other companies
- Maximum Compatible Time WindowsIBM · OAIBM interview questions
- Minimum Markers to Clear Line SegmentsHSBC · OAHSBC interview questions
- Minimum Machines for TasksExpedia · OAExpedia interview questions
- Most Disjoint Intervals From Starts and DurationsDocuSign · OADocuSign interview questions
- 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 Workers with Job AssignmentsLyft · ONSITE INTERVIEWLyft interview questions
- Minimum Appointment Cancellations with a Required BreakMaven Clinic · PHONE SCREENMaven Clinic interview questions
- Minimum Removals for Non-Overlapping IntervalsBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
- Minimum Meeting RoomsSentry · PHONE SCREENSentry interview questions