JavaScript 1 line solution


  • 0
    A
    /**
     * @param {string} moves
     * @return {boolean}
     */
    var judgeCircle = function(moves) {
        return moves.split("L").length == moves.split("R").length && moves.split("U").length == moves.split("D").length;
    };
    

    Adding because I did not see the JS version of the solution yet.


Log in to reply
 

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