Smallest Point with Maximum Interval Coverage
Updated
Problem statement
Given a nonempty collection of closed integer intervals [left, right], return the smallest integer contained in the largest number of intervals.
An interval contains point when left <= point <= right. Count repeated intervals separately. A point interval [a,a] contains a. When several points have maximum coverage, choose the smallest.
Function
smallestMaximumOverlapPoint(intervals: int[][]) → intExamples
Example 1
intervals = [[2,13],[3,5],[1,4],[2,5]]return = 3Both 3 and 4 lie in all four intervals. The specified smallest-point tie rule chooses 3.
Example 2
intervals = [[1,2],[2,4]]return = 2The intervals share their closed endpoint 2, so its coverage is two.
Example 3
intervals = [[-3,-1],[0,2]]return = -3The maximum coverage is one. The smallest covered integer is -3.
Constraints
1 <= intervals.length <= 1000.- Each row has two integers with
-1000000000 <= left <= right <= 1000000000.
More Meta Onsite Interview questions
- Multi-Head Attention Forward PassPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Run-Length Encoded Vector Dot ProductPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Mutual-Friend RecommendationsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Deterministic K-Means AssignmentsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
- Linear Layer Forward and Backward PassesONSITE INTERVIEW · Seen Sep 2026
- Reservoir Sampling with Recorded DrawsONSITE INTERVIEW · Seen Sep 2026
- Stochastic Gradient Descent with MomentumONSITE INTERVIEW · Seen Sep 2026
- Top K Largest Values with a HeapONSITE INTERVIEW · Seen Sep 2026
- Partition a Card Deck into FifteensONSITE INTERVIEW · Seen Sep 2026
- Insert into a Sorted Circular ListONSITE INTERVIEW · Seen Aug 2026
Similar questions at other companies
- Valid Triangle NumberBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
- Travelers per Consecutive City TripletUber · ONSITE INTERVIEWUber interview questions
- Count Winning Dice Face PairsGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
- Merge Overlapping IntervalsShnoor International · ONSITE INTERVIEW
- Generate All Permutations of a NumberFleetx · ONSITE INTERVIEW
- Rank Word-Translation Hints from Sentence TranslationsDuolingo · PHONE SCREEN · ONSITE INTERVIEWDuolingo interview questions
- Top K Frequent ElementsAmazon · OA · PHONE SCREEN · ONSITE INTERVIEW
- Fair Capped Money DistributionGusto · PHONE SCREEN · ONSITE INTERVIEWGusto interview questions
- Group AnagramsAmazon Web Services · ONSITE INTERVIEWAmazon Web Services interview questions
- Merge IntervalsApple · OA · PHONE SCREEN · ONSITE INTERVIEWApple interview questions
Meta interview experiences
- Meta PhD SWE Intern AI Coding Phone Screen: 1 Experience
- Meta Business Support Engineer Phone Screen: 1 Experience
- Meta Software Engineer Onsite Questions: 3 Experiences
- Meta AI Native Engineer OA and Onsite: 1 Experience
- Meta AI-Native Coding Interview: 3 Experiences
- Meta Production Engineer Intern Questions: 6 Experiences