Skip to content

Commit 59acfab

Browse files
committed
Create README - LeetHub
1 parent 52ab196 commit 59acfab

File tree

1 file changed

+38
-0
lines changed
  • 1671-minimum-number-of-removals-to-make-mountain-array

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<h2><a href="https://leetcode.com/problems/minimum-number-of-removals-to-make-mountain-array/">1671. Minimum Number of Removals to Make Mountain Array</a></h2><h3>Hard</h3><hr><div><p>You may recall that an array <code>arr</code> is a <strong>mountain array</strong> if and only if:</p>
2+
3+
<ul>
4+
<li><code>arr.length &gt;= 3</code></li>
5+
<li>There exists some index <code>i</code> (<strong>0-indexed</strong>) with <code>0 &lt; i &lt; arr.length - 1</code> such that:
6+
<ul>
7+
<li><code>arr[0] &lt; arr[1] &lt; ... &lt; arr[i - 1] &lt; arr[i]</code></li>
8+
<li><code>arr[i] &gt; arr[i + 1] &gt; ... &gt; arr[arr.length - 1]</code></li>
9+
</ul>
10+
</li>
11+
</ul>
12+
13+
<p>Given an integer array <code>nums</code>​​​, return <em>the <strong>minimum</strong> number of elements to remove to make </em><code>nums<em>​​​</em></code><em> </em><em>a <strong>mountain array</strong>.</em></p>
14+
15+
<p>&nbsp;</p>
16+
<p><strong class="example">Example 1:</strong></p>
17+
18+
<pre><strong>Input:</strong> nums = [1,3,1]
19+
<strong>Output:</strong> 0
20+
<strong>Explanation:</strong> The array itself is a mountain array so we do not need to remove any elements.
21+
</pre>
22+
23+
<p><strong class="example">Example 2:</strong></p>
24+
25+
<pre><strong>Input:</strong> nums = [2,1,1,5,6,2,3,1]
26+
<strong>Output:</strong> 3
27+
<strong>Explanation:</strong> One solution is to remove the elements at indices 0, 1, and 5, making the array nums = [1,5,6,3,1].
28+
</pre>
29+
30+
<p>&nbsp;</p>
31+
<p><strong>Constraints:</strong></p>
32+
33+
<ul>
34+
<li><code>3 &lt;= nums.length &lt;= 1000</code></li>
35+
<li><code>1 &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
36+
<li>It is guaranteed that you can make a mountain array out of <code>nums</code>.</li>
37+
</ul>
38+
</div>

0 commit comments

Comments
 (0)