|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
Description
- Mario is in a maze, please help Mario to find max available number of coins at the Nth step,
- There are four direction(up, down, left, right) he can move.
- You can not go back.
- ex: N=2, It can not be considered as 1(first step at (1, 4)) -> 9(second step at (2, 4))

- Hint: Level-order tree traversal

Input

Output

Tags