NeetCode #742LC-1866Hard2-D Dynamic Programming
← Back to All Problems

#742 · #1866 · Number of Ways to Rearrange Sticks With K Sticks Visible(恰有 K 根木棍可以看到的排列数目)

📌 Problem Statement & Constraints

There are n sticks of distinct heights 1 to n. Count the permutations in which exactly k sticks are visible when viewed from the left (a stick is visible if it is taller than every stick to its left). Return the count modulo 1e9+7. Constraints: 1 <= n <= 1000, 1 <= k <= n.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!