超时太多了,笔者也开始放弃遍历了
bool judgeCircle(char* moves) {
    int arr[4]={0};
    for(int x=0;x<strlen(moves);x++)
{
    if(moves[x]=='R')
    {
        arr[0]=arr[0]+1;
    }
    if(moves[x]=='L')
    {
        arr[1]=arr[1]+1;
    }
    if(moves[x]=='U')
    {
        arr[2]=arr[2]+1;
    }
    if(moves[x]=='D')
    {
        arr[3]=arr[3]+1;
    }
    
}
if(arr[0]-arr[1]!=0||arr[2]-arr[3]!=0)
{
    return false;
}
return true;
} 
                


















