Trains the technique from
LeetCode 37Sudoku SolverThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A nursery plants seedlings into a 9-by-9 frame. Walkways split the frame after every third row and every third column, so it also reads as nine 3-by-3 plots. Nine varieties are on hand, labelled "1" through "9", and a completed frame carries each variety exactly once in every row, exactly once in every column, and exactly once in every 3-by-3 plot.
The frame arrives part planted as frame, a 9-by-9 grid of one-character strings: frame[r][c] is a variety label already planted there, or "." for a cell still bare.
Plant every bare cell in place, changing frame itself rather than building a second grid, and return that same grid so the finished layout can be read back. Labels the nursery already planted must stay where they are.
Exactly one completed frame extends the layout given, so the answer is unique.
Example 1
Every row, every column and every 3-by-3 plot of the returned frame carries the nine labels once each, and each label the nursery had already planted is still in the cell it started in.
Example 2
A single cell in row 4, column 5 was bare, and label "3" is the one label absent from that row, from that column and from that plot.
Example 3
Nothing was left bare, so the frame is already complete and comes back exactly as it arrived.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def fill_frame(frame: list[list[str]]) -> list[list[str]]:public void fillFrame(char[][] frame)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.