C++ Arithmetic progression |Beats 97.08%
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    bool isArithmetic(vector<int>& nums, int ll, int rr){\n        int minN=*min_element(nums.begin()+ll, nums.begin()+(rr+1));\n        int maxN=*max_element(nums.begin()+ll, nums.begin()+(rr+1));\n        int diff=maxN-minN;\n        if (diff==0) return 1;\n        vector<bool> isElt(diff+1, 0);\n        #pragma unroll\n        for(int i=ll; i<=rr; i++){            \n            int x=nums[i]-minN;\n            isElt[x]=1;\n        }\n        auto [d, r]=div(diff, rr-ll);\n        if (r!=0) return 0;\n        #pragma unroll\n        for(int x=d; x<diff; x+=d)\n            if (isElt[x]==0) return 0;\n        return 1;\n    }\n    vector<bool> checkArithmeticSubarrays(vector<int>& nums, vector<int>& l, vector<int>& r) {\n        int n=nums.size(), m=l.size();\n        vector<bool> ans(m, 0);\n        #pragma unroll\n        for(int i=0; i<m; i++)\n            ans[i]=isArithmetic(nums, l[i], r[i]);\n        return ans;\n    }\n};\nauto init = []()\n{ \n    ios::sync_with_stdio(0);\n    cin.tie(0);\n    cout.tie(0);\n    return \'c\';\n}();\n```
['C++']