Trains the technique from
LeetCode 119Pascal's Triangle 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 drop board is laid out as a triangle of cells. The top row is row 0 and holds a single cell containing 1.
Each row below has one cell more than the row above it. The cell at each end of a row holds 1, and every other cell holds the total of its two neighbours in the row above.
Given level, return the contents of row level, read from left to right.
Example 1
Row 3 reads 1, 3, 3, 1. Row 4 is one cell longer, holds 1 at each end, and its inner cells hold 1 + 3 = 4, 3 + 3 = 6 and 3 + 1 = 4.
Example 2
Row 5 reads 1, 5, 10, 10, 5, 1, so the inner cells of row 6 hold 6, 15, 20, 15 and 6, with 1 at each end.
Example 3
Row 7 reads 1, 7, 21, 35, 35, 21, 7, 1, and totalling its neighbouring pairs gives the inner cells 8, 28, 56, 70, 56, 28 and 8, with 1 at each end.
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 board_row(level: int) -> list[int]:public List<Integer> boardRow(int level)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.