Filter Movies by Inclusive Year Range
Updated
Problem statement
Each entry in movies is a CSV row in the exact form title,year. Return the titles whose release year is between startYear and endYear, inclusive.
For this exercise, assume titles are nonempty and contain no comma. Return matching titles in ascending year order, breaking equal-year ties lexicographically by title.
Function
filterMoviesByYear(movies: String[], startYear: int, endYear: int) → String[]Examples
Example 1
movies = ["Arrival,2016","Alien,1979","Dune,2021","Blade Runner,1982"]startYear = 1980endYear = 2020return = ["Blade Runner","Arrival"]The inclusive range keeps the movies from 1982 and 2016, ordered by year.
Example 2
movies = ["Zeta,2000","Alpha,2000","Old,1999"]startYear = 2000endYear = 2000return = ["Alpha","Zeta"]Both boundary-year movies match, and their titles break the tie.
Constraints
0 <= movies.length <= 10^5- Every row contains one nonempty title without a comma and one valid integer year.
-10^4 <= startYear <= endYear <= 10^4
More Susquehanna International Group (SIG) Phone Screen questions
- Dice Sum That Is a Multiple of mPHONE SCREEN · Seen Nov 2026
- Find Median from Data StreamPHONE SCREEN · Seen Nov 2026
- Painting Arcs to Nearest Neighbors on a CirclePHONE SCREEN · Seen Sep 2026
- Best Single Reroll for Five DicePHONE SCREEN · Seen Feb 2026
- Catching the Bus to the MoviePHONE SCREEN · Seen Jan 2026
- Two Dice Summing to a TargetPHONE SCREEN · Seen Jan 2026
- Median of Uniform Draws in an IntervalPHONE SCREEN · Seen Oct 2025
- One Number Is the Average of the Other TwoPHONE SCREEN · Seen Jun 2025
- Which Coin Pattern Shows Up FirstPHONE SCREEN · Seen May 2025
- Random Points Inside One ArcPHONE SCREEN · Seen Jan 2025
Similar questions at other companies
- Structured Log Stream with QueriesOpenAI · PHONE SCREENOpenAI interview questions
- Piecewise Linear Interpolation and ExtrapolationTwo Sigma · OATwo Sigma interview questions
- Merchant Payout Scheduler, Part 2: Per-Merchant SchedulesStripe · PHONE SCREENStripe interview questions
- Top K Pins with Insert and QueryPinterest · PHONE SCREENPinterest interview questions
- Top K Movies by Play Count from CSV DataTubi · PHONE SCREEN
- Aggressive CowsAmazon · PHONE SCREEN
- Maintain a Consistent-Hashing RingApple · PHONE SCREENApple interview questions
- Stream Cluster Max and MedianSnap Inc. · PHONE SCREENSnap Inc. interview questions
- Server Log Summary and Minute AnomaliesNinjaTrader · PHONE SCREEN
- Insert an Employee into an Organization HierarchyWaymo · PHONE SCREENWaymo interview questions