Print all the leaders in an array. An element is a leader if it's greater than all the elements to it's right (the rightmost element is always a leader).
Approach
The approach is to scan from right to left in the array, keeping track of the maximum. We print it after storing it in the output array.