Solutions


  • 0
    P

    '''
    class Solution {
    public boolean judgeCircle(String moves) {
    int U,D,L,R;
    for ( i=0;i<+moves.length;i++ )
    {
    // if (moves.char[i].equals('U'))
    if (moves.charAt[i].equals('U'))
    {
    U++;
    }
    else if (moves.charAt[i].equals('D'))
    {
    D++;
    }
    else if (moves.charAt[i].equals('L'))
    {
    L++;
    }
    else if (moves.charAt[i].equals('R'))
    {
    R++;
    }
    }

    }
                if((U==D)&(L==R))
                {
                    return true
                }
                else
                {
                    return false
                }
    

    }

    '''


Log in to reply
 

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