Trains the technique from
LeetCode 2661First Completely Painted Row or ColumnThis 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 stockroom wall is an m x n grid of shelf slots. board[r][c] holds the bin ticket assigned to the slot in row r, column c, and every ticket on the wall is different.
A picker works through order, which lists every ticket on the wall exactly once. Each ticket called fills the one slot carrying it.
Return the 0-based index into order of the call after which some row is entirely filled or some column is entirely filled, whichever happens first. A row is entirely filled when all n of its slots are filled, and a column when all m of its slots are filled.
Example 1
Tickets 5, 1 and 3 sit in column 0 of the three rows, so after the third call that column is completely filled. No row is complete at that point, since each row still has one empty slot.
Example 2
The first three calls are exactly the three tickets of row 0, so that row is full after the call at index 2.
Example 3
Ticket 2 sits in row 0, column 1 and ticket 5 in row 1, column 1, so the second call leaves column 1 filled top to bottom. Each row is three slots wide and still has gaps.
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 first_full_line(order: list[int], board: list[list[int]]) -> int:public int firstFullLine(int[] order, int[][] board)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.