Introduction
It is an easy level array algorithm. I wrote the solution based on the idea to iterate the array from left to right once, and majority element will keep change, but last one will be the majority element.
My practice
Here is my sharing on Leetcode discuss.
No comments:
Post a Comment