# sorting advanced

The Most Common Bead, Sorted Style

Remember hunting the most common bead the slow way? Sorted, all matching beads huddle together — count the huddles! 📿

You get a list of bead nums (at least one). Print the most common value; on a tie, the smallest such value.

Example:

Input: nums = [4, 1, 4, 2, 1, 4] Output: 4

Sorted, the list becomes [1, 1, 2, 4, 4, 4] — the run of three 4s is the longest, making 4 the most common.

💡 need a hint?

sort-most-common-sorted.py🔒 given lines are locked — write your code in between
loading...