Majority Elements Problem

Could you help me out what is wrong with this Majority Elements problem code

what is the problem in this code find any logical flaws