Consider the following solitaire game: We have a deck of identical cards. Initially, these cards are split into several heaps, with heaps[i] cards on the i-th heap. Each step of the game looks as follows: Pick one card from each of the heaps and make a new heap out of these cards.
When describing a position in the game, only the heap sizes matter, their order does not. Clearly, sooner or later a position will repeat and the game will become periodic from that point on.
Write a method that takes a int heaps and returns the length of the shortest period of the game.
|-||After some finite number of moves the game must always become periodic.|
|-||heaps will contain between 1 and 50 elements, inclusive.|
|-||Each element in heaps will be between 1 and 50, inclusive.|
|-||The sum of all elements in heaps will be between 1 and 50, inclusive.|