Chunked Round-Robin Row Traversal
Updated
Problem statement
Given a jagged matrix rows and a positive chunkSize, visit active rows in their original order. On each visit, append up to chunkSize remaining values from that row. Continue cycling until every row is exhausted, and return the traversal.
Function
roundRobinRows(rows: int[][], chunkSize: int) → int[]Examples
Example 1
rows = [[1,2,3,4],[5,6],[7,8,9],[10]]chunkSize = 2return = [1,2,5,6,7,8,10,3,4,9]Example 2
rows = [[],[1,2],[3]]chunkSize = 1return = [1,3,2]Constraints
0 <= rows.length <= 1000.- The total number of values is at most
100000. 1 <= chunkSize <= 100000.
More Motive Phone Screen questions
- Group AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
- Longest Equal-Zero-One SubarrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
- Valid Parenthesis StringPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
- Search in Rotated Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2025
- Pair Left and Right Shoes by SizePHONE SCREEN · Seen Jun 2025
- Lowest Common Ancestor in a Binary TreePHONE SCREEN · Seen Apr 2025
- Mark a Queen’s Attack BoardPHONE SCREEN · Seen Feb 2025
- Count Product-Divisible PairsPHONE SCREEN · Seen Sep 2024
- Resolve Variable Equations with Dependency ErrorsPHONE SCREEN · Seen Jun 2024
- Average Values by Binary-Tree LevelPHONE SCREEN · Seen May 2024
Similar questions at other companies
- Constant-Time Weighted Pick with an Alias TableEtched · PHONE SCREEN
- Implement a FIFO QueueByteDance · PHONE SCREENByteDance interview questions
- High-Card Pot GameAffirm · PHONE SCREENAffirm interview questions
- Stateful Paginated Fetch NLyft · PHONE SCREENLyft interview questions
- Music Player Operation SequenceAtlassian · PHONE SCREENAtlassian interview questions
- Machine Message RouterOpenAI · PHONE SCREENOpenAI interview questions
- Simulate a Queued Multi-Rule Rate LimiterSnowflake · PHONE SCREENSnowflake interview questions
- Bus Station Seat AllotmentInMobi · PHONE SCREENInMobi interview questions
- FIFO FizzBuzz Market MatchingGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
- Implement a FIFO QueueOptiver · PHONE SCREENOptiver interview questions