length cells starts with a 1 in every cell. Every second a "wave" passes: all cells are replaced at once by the sum of the cell itself and every cell to its left. So the first cell never changes.
Return the value of the last cell after waves waves, modulo 10⁹ + 7.length=3, waves=4 → 15
[1, 1, 1] → [1, 2, 3] → [1, 3, 6] → [1, 4, 10] → [1, 5, 15], so the last value is 15.
length=1, waves=7 → 1
A single cell always stays at 1.
length=5, waves=2 → 15
[1, 1, 1, 1, 1] → [1, 2, 3, 4, 5] → [1, 3, 6, 10, 15].
length ≤ 1000waves ≤ 1000length=3, waves=4
15
Run checks the first 3 tests in your browser. Submit checks all 66 tests on the server, hidden ones included.