Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ca5878d

Browse files
committed
Create README - LeetHub
1 parent aee5727 commit ca5878d

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<h2><a href="https://leetcode.com/problems/max-chunks-to-make-sorted/">769. Max Chunks To Make Sorted</a></h2><h3>Medium</h3><hr><div><p>You are given an integer array <code>arr</code> of length <code>n</code> that represents a permutation of the integers in the range <code>[0, n - 1]</code>.</p>
2+
3+
<p>We split <code>arr</code> into some number of <strong>chunks</strong> (i.e., partitions), and individually sort each chunk. After concatenating them, the result should equal the sorted array.</p>
4+
5+
<p>Return <em>the largest number of chunks we can make to sort the array</em>.</p>
6+
7+
<p>&nbsp;</p>
8+
<p><strong class="example">Example 1:</strong></p>
9+
10+
<pre><strong>Input:</strong> arr = [4,3,2,1,0]
11+
<strong>Output:</strong> 1
12+
<strong>Explanation:</strong>
13+
Splitting into two or more chunks will not return the required result.
14+
For example, splitting into [4, 3], [2, 1, 0] will result in [3, 4, 0, 1, 2], which isn't sorted.
15+
</pre>
16+
17+
<p><strong class="example">Example 2:</strong></p>
18+
19+
<pre><strong>Input:</strong> arr = [1,0,2,3,4]
20+
<strong>Output:</strong> 4
21+
<strong>Explanation:</strong>
22+
We can split into two chunks, such as [1, 0], [2, 3, 4].
23+
However, splitting into [1, 0], [2], [3], [4] is the highest number of chunks possible.
24+
</pre>
25+
26+
<p>&nbsp;</p>
27+
<p><strong>Constraints:</strong></p>
28+
29+
<ul>
30+
<li><code>n == arr.length</code></li>
31+
<li><code>1 &lt;= n &lt;= 10</code></li>
32+
<li><code>0 &lt;= arr[i] &lt; n</code></li>
33+
<li>All the elements of <code>arr</code> are <strong>unique</strong>.</li>
34+
</ul>
35+
</div>

0 commit comments

Comments
 (0)