class Solution {
public:
bool judgeCircle(string moves) {
std::map<char,int> count;
for(int i = 0;i<moves.size();i++){
if(count.find(moves[i]) == count.end())
count[moves[i]] = 1;
else
count[moves[i]] ++;
}
if ((count['L'] == count['R'])&& (count['U'] == count['D']))
return true;
else
return false;
}
};
Add to List 657. Judge Route Circle
最新推荐文章于 2021-12-18 14:48:30 发布