100% beast
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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<bool> checkArithmeticSubarrays(vector<int>& nums, vector<int>& l, vector<int>& r) {\n         vector<bool> result;\n        for (int i = 0; i < l.size(); i++) {\n            result.push_back(isArithmetic(nums, l[i], r[i]));\n        }\n        return result;\n    }\n\n    bool isArithmetic(vector<int>& nums, int l, int r) {\n        int maxVal = INT_MIN, minVal = INT_MAX;\n\n        for (int i = l; i <= r; i++) {\n            maxVal = max(nums[i], maxVal);\n            minVal = min(nums[i], minVal);\n        }\n\n        int len = r - l + 1;\n        if ((maxVal - minVal) % (len - 1) != 0) {\n            return false;\n        }\n\n        int diff = (maxVal - minVal) / (len - 1);\n        if (diff == 0) {\n            return true;\n        }\n\n        vector<bool> visited(len, false);\n\n        for (int i = l; i <= r; i++) {\n            int val = nums[i];\n            if ((val - minVal) % diff != 0) {\n                return false;\n            } else {\n                int pos = (val - minVal) / diff;\n                if (visited[pos]) {\n                    return false;\n                }\n                visited[pos] = true;\n            }\n        }\n        return true;\n    }\n};\n```
['C++']