Skip to content

Latest commit

 

History

History
16 lines (14 loc) · 299 Bytes

File metadata and controls

16 lines (14 loc) · 299 Bytes
class Solution {
public:
    bool judgeCircle(string moves) {
        int n = moves.size();
        if (n & 1) return false;
        unordered_map<char, int> m;
        for (char &c : moves) {
            m[c]++;
        }
        return m['L'] == m['R'] && m['U'] == m['D'];
     }
};