Trains the technique from
LeetCode 1424Diagonal Traverse IIThis 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 lecture hall is described by seats, a list of rows. Row r holds seats[r].length seats and seats[r][c] is the badge number of the seat in position c of that row, counting from 0. Rows may hold very different numbers of seats, so seats is ragged: nothing guarantees that two rows are the same length.
An usher calls the badges in groups. The group of a seat is r + c, its row index plus its position in the row. Groups are called in increasing order of that number, and inside one group the seats are called from the largest row index down to the smallest.
Return the badge numbers in the order they are called.
Example 1
Group 0 holds only badge 1. Group 1 holds badge 2 from row 0 and badge 9 from row 1, and the higher row is called first, so badge 9 comes before badge 2. Group 2 holds badge 3 from row 0, badge 10 from row 2 and nothing from row 1, since row 1 has no seat in position 1, so the order there is 10 then 3. The remaining groups follow the same rule.
Example 2
With a single row, the group numbers are 0, 1 and 2, one seat each, so the badges come out in row order.
Example 3
Every row holds one seat, so again each group holds a single badge: group 0 is badge 4, group 1 is badge 5 and group 2 is badge 6.
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 diagonal_call_order(seats: list[list[int]]) -> list[int]:public int[] diagonalCallOrder(List<List<Integer>> seats)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.