NeetCode #755LC-629Hard2-D Dynamic Programming
← Back to All Problems#755 · #629 · K Inverse Pairs Array(K 个逆序对数组)
📌 Problem Statement & Constraints
Given
n and k, count the permutations of the integers 1 to n that have exactly k inverse pairs, modulo 1e9+7. An inverse pair is a pair (i, j) with i < j and a[i] > a[j]. Constraints: 1 <= n <= 1000, 0 <= k <= 1000.🔒
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!