#3179

Find the N-th Value After K Seconds

specialist · 825 · lc medium +31 · 53.8% accepted · 122 likes · top 45%

Description

Start with an array a of n ones. Each second, simultaneously replace every a[i] with the prefix sum up to index i (inclusive). Return a[n - 1] after k seconds, modulo 109 + 7.

Code

1
2
3