PythiloEasy · 12 min · Task 35 of 100 · progress kept in this browser

Verify a majority candidate

Return the item occurring more than half the time in a list of integers, or None when none exists.

candidate, balance = 2, 1
next_item = 1
balance += 1 if next_item == candidate else -1
print(balance)
Your task

Return the item occurring more than half the time in a list of integers, or None when none exists.