378. Mumbo-Jumbo's Deck
0
Easy
You have been challenged by Mumbo-Jumbo to a card game. Mumbo-Jumbo will provide you with a deck of cards.
The deck contains N cards, each with an integer written on it.
Determine if it is possible to split the entire deck into one or more groups of cards, where each group has at least 2 cards and all the cards in each group have the same integer.
Return true if such a split is possible, and false otherwise.
Input Format
The first line of input contains an integer N, the size of the deck. The second line contains N space-separated integers representing the values on the cards.
Output Format
Print true if it is possible to split the deck as described, and false otherwise.
Example
Input
8
1 2 3 4 4 3 2 1
Output
true
Constraints
-1 <= deck.length <= 10,000
0 <= deck[i] < 10,000
Loading...
View Submissions
Console