Challenge Information

Title : Finding Leader
Difficulty : Easy
Solutions : 4
Maximum Score : 50
Completed by You: No
Description :

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

Example
Input:
arr = [10, 9, 20, 8, 30, 7, 40]
Output:
The function will return,
[40]

Explanation
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.

Constraints

Judocode