Find the majority element that appears more than n/2 times. Boyer-Moore Voting Algorithm achieves O(n) time and O(1) space. Full C, C++, Java, JavaScript and Python solutions.
Design a class to find the kth largest element in a data stream. Min-heap of size k: the top is always the answer. Full C++, Java, JavaScript and Python.