Skip to content

Commit

Permalink
Q2016 added
Browse files Browse the repository at this point in the history
  • Loading branch information
isinsuarici committed Feb 27, 2023
1 parent 2e90ac9 commit 0e757c3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions E_2016_MaximumDifferenceBetweenIncreasingElements.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class Solution {
public int maximumDifference(int[] nums) {
int min=2147483647;
int max=-1;
int diff=-1;
for(int i: nums){
if(i<=min){
min=i;
max=-1;
}
else if(max<i){
max=i;
if(max-min>diff){
diff=max-min;
}

}
}
return diff;
}
}

0 comments on commit 0e757c3

Please sign in to comment.