Problem Statement | |||||||||||||
The latest version of your favorite adventure game has just been released. On each level you search for stars that earn you points. Simply moving over a location containing stars allows you to acquire them. To help you on your journey, you are given an overhead map of the level in a String[]. Each character in level describes the number of stars at that location. You begin in the upper left spot of the map (character 0 of element 0 of level). On the current stage you must move according to the following rules:
| |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
| - | level will contain between 2 and 50 elements inclusive. | ||||||||||||
| - | Each element of level will contain between 2 and 50 characters inclusive. | ||||||||||||
| - | Each element of level will contain the same number of characters. | ||||||||||||
| - | Each character in each element of level will be a digit ('0' - '9'). | ||||||||||||
| - | Character 0 in element 0 of level will be '0'. | ||||||||||||
Examples | |||||||||||||
| 0) | |||||||||||||
| |||||||||||||
| 1) | |||||||||||||
| |||||||||||||
| 2) | |||||||||||||
| |||||||||||||
| 3) | |||||||||||||
| |||||||||||||