[Java] 1 Lines solution


  • 0
    public boolean judgeCircle(String moves) {
        return (moves.length () - moves.replace ("L", "").length ()) == (moves.length () - moves.replace ("R", "").length ()) &&
            (moves.length () - moves.replace ("U", "").length ()) == (moves.length () - moves.replace ("D", "").length ());
      }
    

    Altought it's too long...


Log in to reply
 

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