Solutions for Finding Leader

    • @kristeencoupp91
    • @Ethan, submitted in Python 3, achived 100% score
    def solve(array):
        n=len(array)
        maxElem = array[-1]
        results = [maxElem]
        for i in range(n - 2, -1, -1):
            if array[i] >= maxElem:
                maxElem = array[i]
                results.append(maxElem)
                results.reverse()
        return results