Problem Statement | |||||||||||||
We have some coins on the table. Each coin is characterized by its size. We want to arrange these coins into successive piles so that the following hold:
You will be given a int[] sizes, each element of which represents the size of a coin on the table. Return the maximal number of piles that we can organize according to the given rules. Each coin should be used in exactly one pile. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | The maximal element of sizes will be unique, so it's always possible to form at least one pile. | ||||||||||||
Constraints | |||||||||||||
- | sizes will have between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of sizes will be between 1 and 1000, inclusive. | ||||||||||||
- | The maximal element of sizes will be unique. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
| |||||||||||||
5) | |||||||||||||
|