Non stack python solution


#1
class Solution:
# @param A : list of integers
# @return a list of integers
def nextGreater(self, A):
    a=[];c=0
    for i in range(len(A)-1):
        for j in A[i:]:
            if(j>A[i]):
                a.append(j)
                c=c+1
                break
        if(c==0):
            a.append(-1)
        c=0
    return a+[-1]