#N657. Robot Return to Origin problem link #solution class Solution { public boolean judgeCircle(String moves) { int[] count = new int[4]; for(char ch: moves.toCharArray()){ if(ch == R) count[0]++; else if(ch == L) count[1]++; else if(ch == U) count[2]++; else count[3]++; } return count[0] - count[1] == 0 && count[2] - count[3] == 0; } } 13 views𝐉𝐚𝐤𝐡𝐨𝐧𝐠𝐢𝐫, 18:50