Easy to understand | C++
Complexity\n- Time complexity:O(m.nlogn)\n\n- Space complexity:O(m+n) \n\n# Code\n\nclass Solution {\npublic:\n    vector<bool> checkArithmeticSubarrays(vector<
# Complexity\n- Time complexity:O(m.nlogn)\n\n- Space complexity:O(m+n) \n\n# Code\n```\nclass Solution {\npublic:\n    vector<bool> checkArithmeticSubarrays(vector<int>& nums, vector<int>& l, vector<int>& r) {\n        int n = nums.size();\n        int m = l.size();\n        vector<bool> result(m, true);\n        for(int i = 0; i < m; i++){\n            int range1 = l[i];\n            int range2 = r[i];\n            vector<int> subarray(nums.begin() + range1, nums.begin() + range2 + 1);\n            sort(subarray.begin(), subarray.end());\n            int diff = subarray[1] - subarray[0];\n            for(int j = 1; j < subarray.size(); j++){\n                if(subarray[j] - subarray[j - 1] != diff){\n                    result[i] = false;\n                    break;\n                }\n            }\n        }\n        return result;\n    }\n};\n\n```
['C++']