[C++] Brute-force solution with sort, 140ms
Idea Just sort and check whether each sub-array nums[l[i] .. r[i]] is arithmetic. Complexity Time O(n^2 log n), loop (O(n)) * sort (O(n log n)) Space O(n) C++ c
## Idea 
Just sort and check whether each sub-array `nums[l[i] .. r[i]]` is **arithmetic**.

## Complexity 
- Time `O(n^2 log n)`, loop (`O(n)`) * sort (`O(n log n)`)
- Space `O(n)`

## C++ code

```cpp
class Solution {
public:
  vector<bool> checkArithmeticSubarrays(vector<int> &nums, vector<int> &l, vector<int> &r) {
    std::vector<bool> res;

    for (int i = 0; i < r.size(); i++) {
      std::vector<int> arr(nums.begin() + l[i], nums.begin() + 1 + r[i]);
      sort(arr.begin(), arr.end());
      
      if(arr.size() == 1) { // Size should be at least two 
        res.push_back(false);
        continue;
      }

      int diff = arr[1] - arr[0];
      bool valid =  true;

      for (int j = 2; j < arr.size(); j++)
        if (arr[j] - arr[j - 1] != diff) {
          valid = false;
          break;
        }
      res.push_back(valid);
    }
    return res;
  }
};
```
[]