In the leader

Given an array of numbers, an element is called a leader if it is greater than all the elements in front of it. What is the sum of the leaders in the text file?

As an explicit example, in the array \([3, 14, 2, 1, 7, 6, 5]\), the leaders of the array are 14 and 7.

×

Problem Loading...

Note Loading...

Set Loading...