An element is leader if it is greater than all the elements to its right side. And the rightmost element is always a leader. For example in the array [16, 17, 4, 3, 5, 2], leaders are 17, 5 and 2.
def getLeaders(arr):
big = arr[len(arr) - 1]
yield big
for i in range(len(arr) - 2, -1, -1):
if arr[i] > big:
big = arr[i]
yield big
arr = [16, 17, 4, 3, 5, 2]
arr
[16, 17, 4, 3, 5, 2]
list(getLeaders(arr))
[2, 5, 17]