Majority Element
Boyer-Moore Voting algorithm. Current will contribute to a candidate’s count if the same as the candidate, otherwise, it deduce counts for all current candidates. Majority Element Given an array, return the majority element, which is defined as the element that exists more than floor(nums.lengh/2) number of times. Solve it using Boyer-Moore Algorithm. The ideas is […]