What is the difference between visited = [[False] * M for _ in range(N)] and visited = [[False] * M] * N
Based on the visisted list declaration, I got different answers for my solution.
I hope to have an answer on this or refer me to some guides that I can read about it. Thank you.
Here is an online complier:
https://onecompiler.com/python/42bxgzxqv
New contributor