Tap here to switch tabs
Problem
Submissions

Problem: Find the N-th Value After K Seconds

Try to solve the Find the N-th Value After K Seconds problem.

Statement

You are given two integers n and k.

Initially, an array a of length n is initialized where a[i] = 11 for all 0≤i<0 \leq i < n.

Every second, the array is updated such that each element at index i is replaced by the sum of all elements from index 00 to index i from the previous second.

Return the value of the element at index n −1- 1 after k seconds.

Note: Since the answer can be large, return the result modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq n, k ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the N-th Value After K Seconds

Try to solve the Find the N-th Value After K Seconds problem.

Statement

You are given two integers n and k.

Initially, an array a of length n is initialized where a[i] = 11 for all 0≤i<0 \leq i < n.

Every second, the array is updated such that each element at index i is replaced by the sum of all elements from index 00 to index i from the previous second.

Return the value of the element at index n −1- 1 after k seconds.

Note: Since the answer can be large, return the result modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq n, k ≤1000\leq 1000