C++ Solution || Sorting Method
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity : O(N^2)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity : O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    vector<bool> checkArithmeticSubarrays(vector<int>& nums, vector<int>& l, vector<int>& r) {\n        vector<bool> result;\n\n        for (int q = 0; q < l.size(); q++) {\n            result.push_back(isArithmetic(vector<int>(nums.begin() + l[q], nums.begin() + r[q] + 1)));\n        }\n\n        return result;\n    }\n\nprivate:\n    bool isArithmetic(const vector<int>& sub) {\n        vector<int> sortedSub(sub);\n        sort(sortedSub.begin(), sortedSub.end());\n        int diff = sortedSub[1] - sortedSub[0];\n        for (int i = 2; i < sortedSub.size(); i++) {\n            if (sortedSub[i] - sortedSub[i - 1] != diff) {\n                return false;\n            }\n        }\n        return true;\n    }\n};\n```
['Array', 'Sorting', 'C++']