Skip to content

Commit

Permalink
Q1502 added.
Browse files Browse the repository at this point in the history
  • Loading branch information
isinsuarici committed Mar 8, 2023
1 parent a900a18 commit dc90952
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions E_1502_CanMakeArithmeticProgressionFromSequence.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class Solution {
public boolean canMakeArithmeticProgression(int[] arr) {
Arrays.sort(arr);
for(int i=0;i<arr.length-2;i++){
if(arr[i]-arr[i+1]!=arr[i+1]-arr[i+2])
return false;
}
return true;
}
}

0 comments on commit dc90952

Please sign in to comment.