1630. Arithmetic Subarrays
- Time complexity: O(N^2)- Space complexity: O(N)Code

# - Time complexity: O(N^2)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

# - Space complexity: O(N)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```c []

bool canMakeArithmeticProgression(int* , int );

bool canMakeArithmeticProgression(int* arr, int arrSize) {
    int temp, diff;
    for(int i = 0; i < arrSize - 1; i++){
        for(int j = i + 1; j < arrSize; j++){
            if(arr[j] > arr[i]){
                temp = arr[i];
                arr[i] = arr[j];
                arr[j] = temp;
            }
        }
    } diff = arr[1] - arr[0];
    for(int i = 0; i < arrSize - 1; i++){
        if(arr[i + 1] - arr[i] != diff)
        return false;
    }
    return true;
}
bool* checkArithmeticSubarrays(int* nums, int numsSize, int* l, int lSize, int* r, int rSize, int* returnSize) {
    bool *ans;
    int *arr, size, k, ansInd = 0;
    ans = (bool *)malloc(sizeof(bool) * lSize);
    for(int i = 0; i < lSize; i++){
        size = r[i] - l[i] + 1;
        arr = (int *)malloc(sizeof(int) * size); k = 0;
        for(int j = l[i]; j <= r[i]; j++){
            arr[k++] = nums[j];
        }
        if(canMakeArithmeticProgression(arr, size))
        ans[ansInd++] = true;
        else
        ans[ansInd++] = false;
    }
    *returnSize = lSize;
    return ans;
}
```
['C']