Did you solve it in an efficient way? |
This is the process I used to solve it. Like i mentioned before i had the solution in my head after a few minutes. I can also showcase the code for further input.
Check when there are ? marks
If found set up a move option that will try out the different movements that can be done
Make sure you only try the movements that follow the rule meaning no out of boundary or trace back
Keep track of the index for the grid and string
When you try a movement direction remember to update the grid
Keep looping through the string
If you come across another ? mark, do the same step
You will maybe need an array of string to keep track of the move options
Also an array of integers to keep track of the indexes
Continue this progress and also update when there are no question marks
When you come across an error, trace back on the index and now check for another move option
Update the grid from that point
If you have checked all the options of that ? mark and there where more previous ? marks ie( ???rlu)
Return to the previous ? mark and check the move options there
Keep looping the string
Again repeat the process of checking for errors
If no errors where giving along the way and we finish the path, but did not reach the goal
Repeat the same progress of tracing back to the previous ? mark
Thanks for the other replys