Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 631 Bytes

README.md

File metadata and controls

25 lines (16 loc) · 631 Bytes

14.Judge Route Circle

Description

Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place.

The move sequence is represented by a string. And each move is represent by a character. The valid robot moves are R (Right), L (Left), U (Up) and D (down). The output should be true or false representing whether the robot makes a circle.

Example1

Input: 'UD'
Output: true

Example2

Input: 'LL'
Output: false

From

LeetCode