There is an array given containing positive integers. Find the leaders in the array.
A leader in the element is, that is greater than or equal to all the elements to its left side and, the rightmost element is always a leader.
Write a function
solve that have the following parameter(s):
1.) arr = array of integers
arr = [10, 9, 20, 8, 30, 7, 40]
The function will return,
The first leader is 20 as it is greater than all the elements to its left. Similarly, the next leader is 30 and, the rightmost element is always a leader so, 40 is also included.