In [1,3,4,1] this case, obviously the majority element is 1, but the expected answer is 4. Did I misunderstand what majority element is?
why would [1,3,4,1] return 4?

@Chao..Feng20 See my reply, I have the same problem. The solutions don't seem to correspond to the question.

@ManuelP Thanks, so the return should satisfy <= n/2, in which case if n/2 = 1, any single digit would satisfy the answer?

@ManuelP Thanks. Though the inputs were invalid, but it return 4 was confusing. but that's another problem.