Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions

Question

Identify the different methods employed in the selection process.

Answered: 1 week ago

Question

Demonstrate the difference between ability and personality tests.

Answered: 1 week ago