Skip to content

Commit 791db53

Browse files
committed
Create README - LeetHub
1 parent 9d00210 commit 791db53

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<h2><a href="https://leetcode.com/problems/k-inverse-pairs-array/">629. K Inverse Pairs Array</a></h2><h3>Hard</h3><hr><div><p>For an integer array <code>nums</code>, an <strong>inverse pair</strong> is a pair of integers <code>[i, j]</code> where <code>0 &lt;= i &lt; j &lt; nums.length</code> and <code>nums[i] &gt; nums[j]</code>.</p>
2+
3+
<p>Given two integers n and k, return the number of different arrays consist of numbers from <code>1</code> to <code>n</code> such that there are exactly <code>k</code> <strong>inverse pairs</strong>. Since the answer can be huge, return it <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong class="example">Example 1:</strong></p>
7+
8+
<pre><strong>Input:</strong> n = 3, k = 0
9+
<strong>Output:</strong> 1
10+
<strong>Explanation:</strong> Only the array [1,2,3] which consists of numbers from 1 to 3 has exactly 0 inverse pairs.
11+
</pre>
12+
13+
<p><strong class="example">Example 2:</strong></p>
14+
15+
<pre><strong>Input:</strong> n = 3, k = 1
16+
<strong>Output:</strong> 2
17+
<strong>Explanation:</strong> The array [1,3,2] and [2,1,3] have exactly 1 inverse pair.
18+
</pre>
19+
20+
<p>&nbsp;</p>
21+
<p><strong>Constraints:</strong></p>
22+
23+
<ul>
24+
<li><code>1 &lt;= n &lt;= 1000</code></li>
25+
<li><code>0 &lt;= k &lt;= 1000</code></li>
26+
</ul>
27+
</div>

0 commit comments

Comments
 (0)