Problem
Find the leaders in an array. A leader is a number that has all the elements on the right-side smaller than its value. There can be multiple leaders, the last number is also a leader.
Input: { 15, 16, 3, 2, 6, 1, 4}
Output: {16, 6, 4}
Find the leaders in an array. A leader is a number that has all the elements on the right-side smaller than its value. There can be multiple leaders, the last number is also a leader.
Input: { 15, 16, 3, 2, 6, 1, 4}
Output: {16, 6, 4}