Here is a clarification about equi leaders: Keeping in mind that a leader, simply put, is the most popular element in an array, if we have an array 434442, the overall leader is 4. The questions is, how many times will we come across equi leaders in this array? To find out, we split the array sequentially like this: 1) 4 (leader = 4) and 34442 (leader = 4) ----------> bingo! first instance of an equi leader 2) 43 (leader = -1, i.e., not there) and 4442 (leader = 4) 3) 434 (leader = 4) and 442 (leader = 4) ---------> bingo! second instance of an equi leader 4) 4344 (leader = 4) and 42 (leader = -1) 5) 11223 (leader = -1) and 3 (leader = 3) Therefore, the count of equi leaders is 2. Reference Codility Lesson 8: Leaders
... View more