Rabbits in Forest
Today, let’s go to the forest and conduct a survey. This would be an interesting task. We specifically choose rabbits and when we meet one, we ask him, hey How many rabbits of your color have you seen in this forest? In a hypothetical world where you know how to communicate with a rabbit, it would be an amazing activity. Now, let’s get into the problem first. Problem Statement There is a forest with an unknown number of rabbits. We asked n rabbits "How many rabbits have the same color as you?" and collected the answers in an integer array answers where answers[i] is the answer of the ith rabbit. Given the array answers, return the minimum number of rabbits that could be in the forest. [1] Example 1: Input: answers = [1,1,2] Output: 5 Explanation: The two rabbits that answered "1" could both be the same color, say red. The rabbit that answered "2" can't be red or the answers would be inconsistent. Say the rabbit that answered "2" ...