Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- bool canMakeArithmeticProgression(vector<int>& arr) {
- sort(arr.begin(),arr.end());
- int d=arr[1]-arr[0];
- for(int i=2;i<arr.size();i++)
- {
- if((arr[i]-arr[i-1])!=d)
- {
- return false;
- }
- }
- return true;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement