Java - O(MN) set without sort
\n    public List<Boolean> checkArithmeticSubarrays(int[] nums, int[] l, int[] r) {\n        List<Boolean> res = new ArrayList<Boolean>();\n        for(int i = 
```\n    public List<Boolean> checkArithmeticSubarrays(int[] nums, int[] l, int[] r) {\n        List<Boolean> res = new ArrayList<Boolean>();\n        for(int i = 0; i < l.length; i++) {\n            res.add(isArithmeticSeq(nums, l[i], r[i]));\n        }\n        \n        return res;\n    }\n    \n    private boolean isArithmeticSeq(int[] nums, int start, int end) {\n        if(end - start < 2) return true;\n        \n        int min=Integer.MAX_VALUE, max=Integer.MIN_VALUE;\n        Set<Integer> set = new HashSet<Integer>();\n        for(int i = start; i <= end; i++) {\n            min = Math.min(min, nums[i]);\n            max = Math.max(max, nums[i]);\n            set.add(nums[i]);\n        }\n        \n        if((max - min) % (end - start) != 0) return false;\n        int interval = (max - min) / (end -start);\n        \n        for(int i = 1; i <= end -start; i++) {\n            if(!set.contains(min + i * interval)) return false;\n        }\n        \n        return true;\n    }\n```
[]