How to solve Hamiltonian Tour (google kickstart round B)

link to problem

Hey @satishsss :wave:
In this problem you have to apply the dfs of the grid b for checking the path, if the current cell is free you can continue in the direction you previously moving but if not you can change your direction for next emtpy cell.
for propper understanding you can refer to this code.

thank you @amiytiwari_adm .

Can you get more specific with your approach and what is your justification for going with your approach.
And how did you come up with the approch.
And what topics should i learn to be able so solve similar type of questions.

Hey @sampatkalyan :wave: ,
We are just doing Depth first search on Grid B and only moving on all those empty cells.if we not able to we change path and search for next empty cells.
To come up with this approach the only thing you can do is solve more problems that you feel little hard(but it does not mean you jump directly to very hard problems)and more importantly is enjoy solving problems.
To solve similar type of problems you need to have good knowledge of Graph/Trees.
You can go through this website and find Graph sections.