Problem Statement |
| Numbers from the sequence seq are placed around a circle in order. During an imposition operation, each number becomes the sum of itself and the next number in order, modulo 100 (i.e., if the sum is greater than or equal to 100, 100 is subtracted from it). The last number in the sequence is summed with the first one, modulo 100.
You will be given a int[] seq and an int N. Return the seq after N imposition operations.
|
|
Definition |
| Class: | RingImposition | Method: | predict | Parameters: | int[], int | Returns: | int[] | Method signature: | int[] predict(int[] seq, int N) | (be sure your method is public) |
|
|
|
|
Constraints |
- | seq will have between 2 and 50 elements, inclusive. |
- | Each element of seq will be between 0 and 99, inclusive. |
- | N will be between 1 and 2000000000, inclusive. |
|
Examples |
0) | |
| | Returns: {8, 9, 7 } | After the first imposition operation the sequence become {1+2, 2+3, 3+1} or {3, 5, 4}.
After the second imposition operation the sequence become {3+5, 5+4, 4+3} or {8, 9, 7}. |
|
|
1) | |
| |
2) | |
| | Returns: {41, 50, 84, 97, 72 } | The sequence transformation is {3, 15, 7, 1, 16} -> {18, 22, 8, 17, 19} -> {40, 30, 25, 36, 37} -> {70, 55, 61, 73, 77} -> {25, 16, 34, 50, 47} -> {41, 50, 84, 97, 72} |
|
|
3) | |
| {3, 15, 7, 1, 16, 1, 72} | 192347 |
| Returns: {88, 72, 62, 55, 11, 11, 21 } | |
|