Python 3 O(n) solution easy and fast


#1
class Solution:
# @param A : list of integers
# @return a list of integers
def solve(self, A):
    c=[A[len(A)-1]]
    m=A[len(A)-1]
    for i in range(len(A)-1,-1,-1):
        if m<A[i]:
            c.append(A[i])
            m=A[i]
    return c