← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
There is a robot that starts at position (0, 0) on an infinite 2-D plane. You are given a string consisting only of the characters 'U', 'D', 'L', and 'R', where each character represents a move: 'U' means move up (increase y by 1) 'D' means move down (decrease y by 1) 'L' means move left (decrease x by 1) 'R' means move right (increase x by 1) Your task is to determine whether the robot returns to the origin (0, 0) after completing all of the moves. Return true if the robot ends up at the origin, otherwise return false.