Efficient and easy C++ solution
```\nbool arithmetic(int a, int b, vectornums)\n    {\n        sort(nums.begin()+a,nums.begin()+b+1);\n        int diff = nums[a+1]-nums[a];\n        for(int i=
```\nbool arithmetic(int a, int b, vector<int>nums)\n    {\n        sort(nums.begin()+a,nums.begin()+b+1);\n        int diff = nums[a+1]-nums[a];\n        for(int i=a+1;i<=b;i++)\n        {\n            if(nums[i]-nums[i-1]!=diff)\n                return false;\n        }\n        return true;\n    }\n    vector<bool> checkArithmeticSubarrays(vector<int>& nums, vector<int>& l, vector<int>& r) {\n        vector<bool>vec(l.size());\n        for(int i=0;i<l.size();i++)\n            vec[i] = arithmetic(l[i],r[i],nums);\n        return vec;\n    }
['C']