mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 19:31:42 +08:00
add leetcode problem-cn part3
This commit is contained in:
32
算法题(国内版)/problem (Chinese)/最大宽度坡 [maximum-width-ramp].html
Normal file
32
算法题(国内版)/problem (Chinese)/最大宽度坡 [maximum-width-ramp].html
Normal file
@@ -0,0 +1,32 @@
|
||||
<p>给定一个整数数组 <code>A</code>,<em>坡</em>是元组 <code>(i, j)</code>,其中 <code>i < j</code> 且 <code>A[i] <= A[j]</code>。这样的坡的宽度为 <code>j - i</code>。</p>
|
||||
|
||||
<p>找出 <code>A</code> 中的坡的最大宽度,如果不存在,返回 0 。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre><strong>输入:</strong>[6,0,8,2,1,5]
|
||||
<strong>输出:</strong>4
|
||||
<strong>解释:</strong>
|
||||
最大宽度的坡为 (i, j) = (1, 5): A[1] = 0 且 A[5] = 5.
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre><strong>输入:</strong>[9,8,1,0,1,9,4,0,4,1]
|
||||
<strong>输出:</strong>7
|
||||
<strong>解释:</strong>
|
||||
最大宽度的坡为 (i, j) = (2, 9): A[2] = 1 且 A[9] = 1.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ol>
|
||||
<li><code>2 <= A.length <= 50000</code></li>
|
||||
<li><code>0 <= A[i] <= 50000</code></li>
|
||||
</ol>
|
||||
|
||||
<p> </p>
|
Reference in New Issue
Block a user