Find the Special Interest in Each Board
You are scrolling through Pinterest and stumble upon a collection of boards. Each board is organized such that it has an even number of pins and at least 6 pins. The boards are provided as a list of lists.
Each sublist contains exactly three different possible integers, each representing the interest of the pin: a default interest that appears half the time, an outlier interest that appears exactly once, and a special interest that appears the rest of the time.
Write a function that takes in the list of lists of interests of the pins and returns a list with the special interest from each sublist.
Sample input/output:
boards = [[1, 2, 9, 9, 9, 2],
[15, 14, 13, 14, 14, 15, 14, 15],
[5, 5, 6, 6, 6, 7],
[10, 8, 10, 8, 8, 11, 10, 10],
]
find_special_interests(boards) => [2, 15, 5, 8]
The key idea is to identify, for each board, the value whose frequency matches the repeated“special”pattern rather than the once-only outlier or the half-frequency default. Because each sublist contains only three distinct values with fixed repetition behavior, a simple frequency map or Counter is enough to solve the problem efficiently. This is a straightforward counting problem with linear time over the total number of elements.