Wrong ans helppp!


#1
int i = 0 ;

void validate(vector<int> &arr , int lower , int upper )
{
    if (i == arr.size() or arr[i] < lower or arr[i] > upper)
        return ;

    int val = arr[i];
    i++;
    validate(arr , lower , val);
    validate(arr , val  , upper);
}
int Solution::solve(vector<int> &arr) {
    
    validate(arr , INT_MIN , INT_MAX);
    return i == arr.size();
}