From quite a long time I was trying to solve this problem 225D - Snake, but I am stuck on how to create a mask for this snake and how to extract information from the mask for doing further BFS.
I referred to I_love_Tanya_Romanova's solution 4086309 for the same, but was unable to understand the magic behind his mask.
So can someone help me understanding how to create mask for this problem.
Many others have used a hash function to solve this problem. I wonder how?