Leaders of Elements (Id-1244)

Just for Practice 1 Additional [3-Jan-2018 to 10-Apr-2018]

Bonus Practice Sheet Winter 2018 [17-Mar-2018 to 7-Apr-2018]

Program ID- 1244

Given a set of ‘n’ elements in an order, identify all the leaders and print them. An element is said to be a leader if all the elements to its right are smaller than it. For example, if the elements are 12, 13, 16, 7, 10 then there is only one leader element 16. If there are no leaders in the given set of elements then print ‘No leaders’.

Input Format

Number of elements in the given set: ‘n’

element-1

element-2

element-n

Output Format

Elements that are leaders. Else, print ‘No leaders’ when there is no leader.

Code

Please Comment Working if the code worked to you

If you have other working codes please comment the codes enclosing with <pre> and </pre> 🙂

Example: <pre> Your Code </pre>

C Code [By Chir Patel]

C Code [By Mounish Sai]

C++ Code [By Mounish Sai]

 

The Above Codes are for reference only. It doesn't mean everyone to directly copy/paste those codes.

 

Click Here to Leave a Comment Below 0 comments

Leave a Reply:

This site uses cookies and by using the site you are consenting to this.