顯示具有 657 標籤的文章。 顯示所有文章
顯示具有 657 標籤的文章。 顯示所有文章

2018年5月16日 星期三

Leetcode - 657. Judge Route Circle

Question:
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.