Second Largest and Majority Element
Interview insights are lockedSee how often this is asked and which companies asked it with Buncho Pro.(1) Find the second-largest distinct number in a list. (2) Find the majority element (appears more than n/2 times). Both in O(n).