ProgrammingGreedy Algorithm easy 52.3% Success 649 52 Bookmark Asked In: Problem Description Given an array of size N, find the majority element. The majority element is the element that appears more than floor(N/2) times. You may assume that the array is non-empty and the majority elem...
Similar as "Majority Element". There are at most 2 such elements, for > floor(n/3), andevery non-hit element will decrease count of EACH hit element. https://leetcode.com/discuss/42769/o-n-time-and-in-o-1-space-c-solution