The question tells us that each person in the group wrote down a number from 1 to 31.
Before looking at the data statements, we can imagine that some people write down the same number, and we can also imagine that they don't. Of course, it's always that way on Data Sufficiency questions; the question is never resolved in advance. Let's turn to the statements, separately first.
Statement (1) says that the number of people in the group was greater than 35. We imagine a case: say the number is 36. It would be easy to get people who have written the same number. In fact, it would be impossible not to: if we could line up one person per each day of the month, up to 31, and after 31, we would have to start assigning people to numbers that already have people. Of course, we're not assigning people, but the same logic holds: for a group of 32 or above, there must be a duplication. That means that no matter what the case, as long as Statement (1) holds, there will be duplications and hence we can answer the question definitively.
Hence Statement (1) is sufficient.
Statement (2) allows some of the same cases as Statement (1) did. For example, it's possible that the class has 40 people, and as we discussed, that means that it will have duplicate numbers. But in another case, the number of people in the class could be 10; in that case, they might possibly all have different birthdays, with no duplicates. The group could have only one person! Then, there would be no repeated numbers. Therefore, Statement (2) allows cases with duplicates and without duplicates. A definitive answer is not possible, so Statement (2) is insufficient.
The correct answer is (A).
Fun fact: In a room of 23 people, there is a 50% chance that two people in the room will share the same birthday. Statisticians call this “The Birthday Paradox.”