Skip to content

Commit 6b0e682

Browse files
committed
Added README.md file for Monotonic Array
1 parent cdfe891 commit 6b0e682

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

932-monotonic-array/README.md

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/monotonic-array">Monotonic Array</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><p>An array is <strong>monotonic</strong> if it is either monotone increasing or monotone decreasing.</p>
2+
3+
<p>An array <code>nums</code> is monotone increasing if for all <code>i &lt;= j</code>, <code>nums[i] &lt;= nums[j]</code>. An array <code>nums</code> is monotone decreasing if for all <code>i &lt;= j</code>, <code>nums[i] &gt;= nums[j]</code>.</p>
4+
5+
<p>Given an integer array <code>nums</code>, return <code>true</code><em> if the given array is monotonic, or </em><code>false</code><em> otherwise</em>.</p>
6+
7+
<p>&nbsp;</p>
8+
<p><strong class="example">Example 1:</strong></p>
9+
10+
<pre>
11+
<strong>Input:</strong> nums = [1,2,2,3]
12+
<strong>Output:</strong> true
13+
</pre>
14+
15+
<p><strong class="example">Example 2:</strong></p>
16+
17+
<pre>
18+
<strong>Input:</strong> nums = [6,5,4,4]
19+
<strong>Output:</strong> true
20+
</pre>
21+
22+
<p><strong class="example">Example 3:</strong></p>
23+
24+
<pre>
25+
<strong>Input:</strong> nums = [1,3,2]
26+
<strong>Output:</strong> false
27+
</pre>
28+
29+
<p>&nbsp;</p>
30+
<p><strong>Constraints:</strong></p>
31+
32+
<ul>
33+
<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
34+
<li><code>-10<sup>5</sup> &lt;= nums[i] &lt;= 10<sup>5</sup></code></li>
35+
</ul>

0 commit comments

Comments
 (0)