Skip to content

Latest commit

 

History

History
7 lines (4 loc) · 251 Bytes

README.md

File metadata and controls

7 lines (4 loc) · 251 Bytes

This problem was asked by MongoDB.

Given a list of elements, find the majority element, which appears more than half the time (> floor(len(lst) / 2.0)).

You can assume that such element exists.

For example, given [1, 2, 1, 1, 3, 4, 0], return 1.