Boyer-Moore Voting Algorithm: Find the Majority Element Efficiently
๐ Introduction
One of the interesting questions asked in interviews is given an array of size n, find the majority element. The majority element is the one which appears more than n/2 times in the array.
A brute-force way to solve this problem would...
amanvw.hashnode.dev4 min read