1
class Solution {
2
public boolean judgeCircle(String moves) {
3
int up = 0;
4
int rt = 0;
5
for (int i = 0; i < moves.length(); i++) {
6
if (moves.charAt(i) == 'U') up++;
7
if (moves.charAt(i) == 'R') rt++;
8
if (moves.charAt(i) == 'L') rt--;
9
if (moves.charAt(i) == 'D') up--;
10
}
11
if (up == 0 && rt == 0) return true;
12
return false;
13
}
14
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0