Once there was a king. The king wanted to protect his kingdom from the outside world. So he made a rule that neither any citizen of the kingdom can go to the outer world nor anyone from outside can enter his kingdom. There was a common bridge between the kingdom and the outside world. The guard was assigned on the gates of the kingdom which was linked to the bridge. If anyone tried to go out of the kingdom, he/she will be killed. And if anyone tried to come inside the kingdom, the guards would sent him/her back. It takes 8 minutes to cross the bridge.
The guard was allowed to take a 5 minutes break. One woman was able to cross the bridge and move to the outside world. How did she do that?
The time when the guard was at rest, the woman started to walk towards the outer world. She walked for 5 minutes and then turned back towards the kingdom. Since she had no document with her, she was not allowed to come inside the kingdom. Therefore the guard sent her. Hence she was able to leave the kingdom.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.