Skip to content

Commit

Permalink
Create Readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
wisdompeak authored Jan 19, 2020
1 parent 752d36a commit 21e4e6d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Others/775.Global-and-Local-Inversions/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### 775.Global-and-Local-Inversions

对于A[i]而言,它不在乎A[i-1]是否比它大。即使比它大,也只是引入了一个local inversion,而不会有额外的global inversion。而要避免牵扯更多的global inversion,唯一的要求就是第i-2个元素及之前的所有元素都要比A[i]小。于是我们可以在遍历元素i的过程中,维护一个curMax,记录的是从第0个元素到第i-2个元素的最大值。只要出现```curMax > A[i]```即返回false。

0 comments on commit 21e4e6d

Please sign in to comment.