Courses‎ > ‎APCS - Term 1‎ > ‎Konstantinovich‎ > ‎

2019-02-15

posted Feb 15, 2019, 7:27 AM by Konstantinovich Samuel
Given a 5x5 board with the following configuration

0 0 0 0 0
0 1 0 3 0
0 0 0 0 0
0 0 2 0 0 
0 0 0 0 0


We are currently at row 1 col 4, explain:
What does the value returned by countSolutions( move = 4, row = 0, col = 2) represent?



Optimization:
1. Make sure you can generate the number of outgoing moves on an empty M x N board.
2. Make sure when making moves, it properly updates the numbers on the outgoing moves.
3. Make a data structure that stores and sorts the coordinates, and the number of outgoing moves.
4. Instead of looping over the list of all moves, add the coordinates/outgoingMoves to the data structure and loop over the data structure instead.
Comments