Super Simple Javascript Solution


  • 0
    R

    Quick and easy solution

    var judgeCircle = function(moves) {
        return (moves.match(/U/g) || []).length === (moves.match(/D/g) || []).length && (moves.match(/L/g) || []).length === (moves.match(/R/g) || []).length
    };
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.