-
1502. Can Make Arithmetic Progression From Sequence javaLeetCode_Study_Plan/Programming Skills 2022. 9. 19. 22:24
class Solution { public boolean canMakeArithmeticProgression(int[] arr) { Arrays.sort(arr); int diff = arr[1] - arr[0]; for (int i = 2; i < arr.length; i++) { if (arr[i] - arr[i-1] != diff){ return false; } } return true; } }
'LeetCode_Study_Plan > Programming Skills' 카테고리의 다른 글
1790. Check if One String Swap Can Make Strings Equal java (0) 2022.09.20 202. Happy Number java (0) 2022.09.20 1822. Sign of the Product of an Array java (0) 2022.09.19 1779. Find Nearest Point That Has the Same X or Y Coordinate java (0) 2022.09.19 976. Largest Perimeter Triangle java (0) 2022.09.19