Split Story Frame Numbers Into Runs of Consecutive Frames
Last updated: November 29, 2026
Quick Overview
Given a multiset of Story frame numbers and a group size w, split them into groups of w consecutive numbers each, or return an empty list if that is impossible.
Meta
November 29, 20260
0
0 solved
Given a multiset of Story frame numbers and a group size w, split them into groups of w consecutive numbers each, or return an empty list if that is impossible.
A Meta technical-screen greedy question that relies on ordered keys. The interviewer looks for the observation that the smallest remaining number must start a group, and for an efficient walk over sorted distinct keys rather than repeatedly removing from a list.
What the Interviewer Expects
- Reject when the count is not divisible by w
- Count occurrences per frame number
- Process distinct keys in ascending order
- Start as many runs at a key as its remaining count
- Fail when a needed successor is short
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Return only True or False with O(n log n) and minimal memory.
- What if gaps of one missing frame are allowed in a run?
- What if group sizes may vary between w and 2w?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
- Input: list of integers (may repeat), group size
w >= 1. - Output: list of groups, each
[x, x + 1, ..., x + w - 1], using every number exactly once;[]if impossible....
High-Level Design
The smallest remaining number cannot be in the middle of any group (nothing smaller is left to precede it), so it must start a group. That forces the greedy:
- Count each number.
- Walk distinc...