replies.
Not everyone was asked, so the real number of guests is unknown. Return the smallest number of guests consistent with all the answers.replies=[2, 2, 2, 2] → 6
A reply of 2 means three people wear that color. Four such guests cannot fit in one group of three, so there are two colors of three guests each, 6 in total.
replies=[0, 1, 0] → 4
Each guest who said 0 is alone in their color, that is 2 guests. The one who said 1 shares a color with one more guest who was not asked. That makes 4.
replies.length ≤ 1000replies[i] < 1000replies=[2, 2, 2, 2]
6
Run checks the first 3 tests in your browser. Submit checks all 68 tests on the server, hidden ones included.