Simplest 10 Lines Solution


#1
    def func(i,j,check):
        if i>j:
            return True
        if A[i]<check:
            return False
        k=j+1
        for h in range(i+1,j):
            if A[h]>A[i]:
                k=h
                break
        return func(i+1,k-1,check) and func(k,j,A[i])
    return 1 if func(0,len(A)-1,-1) else 0