Reddit Question · Mar 2026

Boyer moore voting algorithm

8 upvotes 5 replies

Question Details

So I was solving the majority element question on leetcode and I do not know how to use hash maps right now. I am yet to learn them so I was using frequency array and trying to solve the problem but i

Full Details

So I was solving the majority element question on leetcode and I do not know how to use hash maps right now. I am yet to learn them so I was using frequency array and trying to solve the problem but it continued to throw errors so I searched the problem up and discovered boyer moore voting algorithm and it was easy to understand but how am I supposed to think of this on my own without ever having read this. Am i supposed to think this stuff on my own sort of like creating them????

Free preview. Unlock all questions →

Topics

Arrays Hash Table