Arithmetic-Subarrays 💡💡💡
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 solve(vector<int>& nums,int first,int last){\n        vector<int>temp;\n        for(int i=first;i<=last;i++){\n            temp.push_back(nums[i]);\n        }\n        sort(temp.begin(),temp.end());\n        int diff=temp[1]-temp[0];\n        for(int i=1;i<temp.size()-1;i++){\n            if((temp[i+1]-temp[i])!=diff){\n                return false;\n            }\n        }\n        return true;\n    }\n    vector<bool> checkArithmeticSubarrays(vector<int>& nums, vector<int>& l, vector<int>& r) {\n         vector<bool>ans;\n        for(int i=0;i<l.size();i++){\n            int first=l[i];\n            int last=r[i];\n            if((last-first+1)>=2){\n                ans.push_back(solve(nums,first,last));\n            }\n            else{\n                ans.push_back(false);\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']