Question: There are n uniquely - sized planks whose lengths are integers from 1 to n . You need to arrange the planks such that exactly

There are n uniquely-sized planks whose lengths are integers from 1 to n. You need to arrange the planks such that exactly k planks are visible from the top. A plank is visible from the top if there are no longer planks to the top of it.
For example, if the planks are arranged [1,3,2,5,4], then the planks with lengths 1,3, and 5 are visible from the top.
Given n and k, return the number of such arrangements. Since the answer may be large, return it modulo 109+7.
Constraints:
1<=n<=1000
1<=k<=n
Test case 0:
Input: n=3, k=2
Output: 3
Test case 1:
Input: n=5, k=5
Output: 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!