Closed saqib-vm1 closed 1 year ago
My approach for Q2. Find leaders in an array
We can use filter method of 'Array' to get an array of leaders.. To get leaders in array returned by the filter method.. we need to return true for leader element from inside the callback of filter method..
// To check if the element is leader or not.. // we need to compare element with all other elements on the right side of it..
solution for leaders in an array close #58