Imagine you're a wildlife researcher conducting a survey in a mysterious forest. You've encountered n rabbits and asked each one a simple question: "How many other rabbits have the same color fur as you?"
The rabbits are quite cooperative and provide their answers in an array called answers, where answers[i] represents the i-th rabbit's response.
Here's the key insight: if a rabbit says there are k other rabbits with the same color, then there are actually k + 1 rabbits of that color in total (including the rabbit answering).
Your goal: Determine the minimum possible number of rabbits that could exist in the forest based on these answers.
Example: If two rabbits both say "1" (meaning each sees 1 other rabbit of their color), they could be referring to each other, so we need minimum 2 rabbits total, not 4.
Input & Output
Constraints
- 1 โค answers.length โค 1000
- 0 โค answers[i] โค 999
- Each rabbit gives one honest answer about others of their color