Sally wants more apples!

Computer Science Level 5

Last time, Sally moved through her garden eating an apple in every square.

But this time Sally feels more enthusiastic. This time she's going to do the same but now, she can also move diagonally. Find the number of ways in which Sally can eat all 25 apples

Details and Assumptions

  • She has a \(5 \times 5\) garden with total of 25 apples.

  • She can move forward, backward, up, down or diagonally as long as there is an apple in the cell she is moving to.

  • She is standing in the center of the garden, i.e. \(3^{\text{rd}}\) row and \(3^{\text{rd}}\) column.

  • If the garden was of size \(3 \times 3\), then she can eat all the apples in exactly 32 ways.


  • The best C++ code (so far) takes nearly 100 seconds on a Quad Core \(2.67\) GHz processor. So, it's okay if your code is running for long.



Problem Loading...

Note Loading...

Set Loading...