Hello,
I have reviewed your code and tried to run it. I have a few things to say. First of all your code has some good organization, and it was very easier for me to understand and keep track of things. Secondly, I believe that you have surely tried to find optimum solution, but I believe the BFS here is not a very optimal choice since you did not go for a higher N (i tried it too and it didn't work as I believed it would). I believe DFS or some other approach can give you better results for a higher N. The results are nevertheless very optimal. Good work. :)
Hello,
I have reviewed your code and tried to run it. I have a few things to say. First of all your code has some good organization, and it was very easier for me to understand and keep track of things. Secondly, I believe that you have surely tried to find optimum solution, but I believe the BFS here is not a very optimal choice since you did not go for a higher N (i tried it too and it didn't work as I believed it would). I believe DFS or some other approach can give you better results for a higher N. The results are nevertheless very optimal. Good work. :)