标签:public tco move ring turn else string -- return
class Solution {
public:
bool judgeCircle(string moves) {
int x = 0;
int y = 0;
for(auto c:moves){
if(c==‘U‘){
y++;
}
else if(c==‘D‘){
y--;
}
else if(c==‘R‘){
x++;
}
else if (c==‘L‘){
x--;
}
}
return (x==0 && y==0);
}
};
标签:public tco move ring turn else string -- return
原文地址:https://www.cnblogs.com/theodoric008/p/9370942.html