1502. Can Make Arithmetic Progression From Sequence
A sequence of numbers is called an arithmetic progression if the difference between any two consecutive elements is the same.
Given an array of numbers arr, return true if the array can be rearranged to form an arithmetic progression. Otherwise, return false.
- Time : O(n)
- Space : O(n)
c++
1 | public: |
- Time : O(nlogn)
- Space : O(1)
c++
1 | class Solution { |