Skip to content

Commit 59eccdc

Browse files
authored
docs: add a description of the solution to lc problem: No.2016 (doocs#728)
No.2016.Maximum Difference Between Increasing Elements
1 parent 12e3c4a commit 59eccdc

File tree

1 file changed

+8
-0
lines changed
  • solution/2000-2099/2016.Maximum Difference Between Increasing Elements

1 file changed

+8
-0
lines changed

solution/2000-2099/2016.Maximum Difference Between Increasing Elements/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@
5151

5252
<!-- 这里可写通用的实现逻辑 -->
5353

54+
此题并不能单纯遍历数组,寻找其中的最大最小值,然后计算差,因为需要保证最大最小值的前后顺序。
55+
56+
**步骤:**
57+
58+
1. 只维护最小值与最大差值(返回值)。
59+
2. 遍历数组,当遍历元素比最小值大时,与最小值比较,更新最大差值。
60+
3. 否则更新最小值。
61+
5462
<!-- tabs:start -->
5563

5664
### **Python3**

0 commit comments

Comments
 (0)