Leetcode Problem 1502. Can Make Arithmetic Progression From Sequence
1502. Can Make Arithmetic Progression From Sequence
Leetcode Solutions
Sorting and Checking Consecutive Differences
Sort the array arr.
Calculate the difference diff between the first two elements in the sorted array.
Iterate through the sorted array starting from the second element.
a. For each element at index i, check if arr[i] - arr[i - 1] is equal to diff.
b. If the difference is not equal to diff, return false.
If the loop completes without returning false, return true.