Java - 94% fast - no sorting - O(N) Math tricks to determine whether arithmetic sequence or not
\n\nclass Solution {\n    public List<Boolean> checkArithmeticSubarrays(int[] nums, int[] l, int[] r) {\n        int i, N = l.length;\n        List<Boolean> res
```\n\nclass Solution {\n    public List<Boolean> checkArithmeticSubarrays(int[] nums, int[] l, int[] r) {\n        int i, N = l.length;\n        List<Boolean> result = new ArrayList<Boolean>();\n        \n        for(i = 0; i < N; i++){\n            result.add(isArithmeticSequence(nums, l[i], r[i]));\n        }\n        \n        return result;\n    }\n    \n\t// O(N) logic for every invocation to check whether the subsequence can be made an arithmetic progression or not\n    private boolean isArithmeticSequence(int[] nums, int start, int end){\n        if(start > end)\n            return false;\n        else if(start == end)\n            return true;\n        else if(start + 1 == end)\n            return true;\n        else{\n            // find min and max elements of the sub-array\n            int min = Integer.MAX_VALUE;\n            int max = Integer.MIN_VALUE;\n            int i, N, diff, multiple;\n            for(i = start; i <= end; i++){\n                min = Math.min(min, nums[i]);\n                max = Math.max(max, nums[i]);\n            }\n            \n\t\t\t// if it is an Arithmetic sequence, then min is first element and max is last element, and this is an ascending ordered arithmetic sequence\n\t\t\t\n            N = (end - start + 1);\n            if((max - min) % (N - 1) != 0)  // AP sequence is a, a+d, a+2d, a+3d, ..., a+(N-1)d\n                return false;\n            else{\n                // calculate common difference\n                diff = (max - min) / (N - 1);\n                \n                if(diff == 0){\n                    // special case : all elements must be equal\n                    for(i = start; i <= end; i++){\n                        if(nums[i] != min){\n                            return false;\n                        }\n                    }\n                    \n                    return true;\n                }else{\n                    // for every element - compute ((element - min) / d)\n                    // all values must be unique integers ranging from 0 to (N - 1)\n                    boolean[] flags = new boolean[N];\n                    for(i = start; i <= end; i++){\n                        if((nums[i] - min) % diff != 0)  // this number is NOT of the form (a+k*d)\n                            return false;\n                        \n                        multiple = (nums[i] - min) / diff;\n                        if(multiple < 0 || multiple >= N)  \n                            return false;\n                        \n                        flags[multiple] = true;\n                    }\n                    \n                    for(i = 0; i < N; i++){\n                        if(!flags[i])   // indicates at least one missing element from the expected arithmetic sequence\n                            return false;\n                    }\n                    \n                    return true;\n                }\n            }\n        }\n    }\n}\n\n```
[]