Minimum Processes to Drop for Synchronization
Updated
Problem statement
A team runs n processes. Process i executes during the inclusive interval [starts[i], ends[i]].
A remaining set of processes is synchronized if at least one process in the set has an execution interval that overlaps the execution interval of every other process in the set. Intervals that share an endpoint overlap.
Return the minimum number of processes that must be dropped so that the remaining processes form a synchronized set.
A set containing only one process is synchronized.
Function
minimumProcessesToDrop(starts: int[], ends: int[]) → intExamples
Example 1
starts = [1,2,3,4]ends = [2,3,5,5]return = 1Drop the process with interval [4, 5]. Among the remaining intervals, [2, 3] overlaps [1, 2] at time 2 and [3, 5] at time 3, so the remaining set is synchronized.
Example 2
starts = [1,4,6]ends = [10,5,8]return = 0The interval [1, 10] overlaps both other intervals, so all three processes already form a synchronized set.
Example 3
starts = [1,4,7]ends = [2,5,8]return = 2The three intervals are pairwise disjoint. Keeping any one process produces a synchronized singleton, so two processes must be dropped.
More Amazon Online Assessment questions
- Lexicographically Largest IdentifierOA · Seen Nov 2026
- Maximize Shipment Order by Sorting One WindowOA · Seen Nov 2026
- Top K Frequent ElementsOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Fill One Exact-Length Binary WindowOA · Seen Nov 2026
- Minimum Grid InconvenienceOA · Seen Nov 2026
- Maximize K-Element AND with an Increment BudgetOA · Seen Nov 2026
- Task SchedulerOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Get Smallest Base SegmentOA · Seen Nov 2026
- Minimum Cost of Left and Right PropagationOA · Seen Nov 2026
- Maximum Equal-Bit Pairs in a SubsequenceOA · Seen Nov 2026
Similar questions at other companies
- Maximum Interactive Team SizeMicrosoft · OAMicrosoft interview questions
- Maximum Team SizeExpedia · OAExpedia interview questions
- Employee With the Most OverlapsCitadel · OACitadel interview questions
- Query Weekly Store Opening HoursApple · PHONE SCREENApple interview questions
- Closed Interval Overlap QueriesNetflix · ONSITE INTERVIEWNetflix interview questions
- Batch Point-in-Range QueriesGoogle · PHONE SCREENGoogle interview questions
- Classify Heap Addresses from a Memory SnapshotSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
- Unexplained Sightings Outside Flight IntervalsMobileCoin · PHONE SCREEN
- Maximum Event Value with an Attendance LimitSnowflake · PHONE SCREENSnowflake interview questions
- Count Lamps Lighting Each PointAirbnb · OAAirbnb interview questions