← All problemsSign in

Cross the Path

Chef has a Robot, he gives the Robot some set of instructions that the Robot will follow. Chef is interested in knowing if there will be any point when Robot will cross the path that is if at any time robot is on a location that it had previously visited. The instructions will be a string $S$, where $S[i]$ = '$N$', '$S$', '$E$' or '$W$', each representing moving one unit north, south, east, or we

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start