neerajnanvani / PracticeGitAndJs

Its an practice repo to create pull request and use more github features
0 stars 10 forks source link

Find leaders #23

Closed rajat1722 closed 1 year ago

rajat1722 commented 2 years ago

We run a loop from the first index to the 2nd last index. And for each index, we run another loop from the next index to the last index. If all the values to the right of that index are smaller than the index, we simply add the value in our answer data structure.