Implementing one of the solutions of majority element finding problem