Hi, here’s your problem today. This problem was recently asked by AirBNB:
A majority element is an element that appears more than half the time. Given a list with a majority element, find the majority element.
Here’s an example and some starting code.
def majority_element(nums):
# Fill this in.
print(majority_element([3, 5, 3, 3, 2, 4, 3]))
# 3