[C++] Using Sort O(MN LogN) Solution
Instruction:\n1. For each query, we create a vector array [l, j].\n2. Sort the newly created vector array\n3. Run and see if is arithmetic according the questio
Instruction:\n1. For each query, we create a vector array [l, j].\n2. Sort the newly created vector array\n3. Run and see if is arithmetic according the question description.\n4. Repeat 1-3 until all queries have completed.\n\nComplexity:\nRuntime: O(MN LogN), Space: O(N)\n\n```\nclass Solution {\npublic:\n    vector<bool> checkArithmeticSubarrays(vector<int>& nums, vector<int>& l, vector<int>& r) {\n        vector<bool> res;\n        vector<int> arr;\n        for (int i = 0; i < l.size(); ++i) {\n            int left = l[i], right = r[i];\n            arr.clear();\n            for (int j = left; j <= right; ++j) {\n                arr.push_back(nums[j]);\n            }\n            sort(arr.begin(), arr.end());\n\n            bool isArithmetic = true;\n            for (int k = 1; k < arr.size()-1; ++k) {\n                if ((arr[k+1] - arr[k]) == (arr[1] - arr[0])) {\n                    continue;\n                } else {\n                    isArithmetic = false;\n                    break;\n                }\n            }\n            res.push_back(isArithmetic);\n        }\n        return res;\n    }\n};\n```
['C']