Find majority element problem

https://ide.codingblocks.com/s/298109 this code is not showing the same output (1 2) as given in problem but still all the test case passed how is this possible?

but this code show correct ans 2 1
there is nothing mention in question about order of ans
means output can be in any order

so code is correct and hence pass all testcases

if you have more doubts regarding this feel free to ask
i hope this helps
if yes hit a like :heart:: and don’t forgot to mark doubt as resolved :grinning:

so there is no problem if sometime code output does not match with sample output

no problem
only if order doesn’t matter

if in question it is mention that output should be in specific order
then it should be in that order