We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6cb7f79 + f1a9c8f commit 24e026dCopy full SHA for 24e026d
arithmeticProgression.java
@@ -0,0 +1,13 @@
1
+// https://leetcode.com/problems/can-make-arithmetic-progression-from-sequence/
2
+
3
+class arithmeticProgression {
4
+ public boolean canMakeArithmeticProgression(int[] arr) {
5
+ Arrays.sort(arr);
6
+ int difference = arr[1] - arr[0];
7
+ for (int i = 2 ; i <= arr.length - 1 ; i++) {
8
+ if ((arr[i] - arr[i - 1]) != difference)
9
+ return false;
10
+ }
11
+ return true;
12
13
+}
0 commit comments