解題說明
C++ 解法
複雜度分析
虛擬碼
1. Initialize position (x, y) = (0, 0) and direction = North. 2. For each instruction: a. 'G': move one step in current direction. b. 'L': turn left 90 degrees. c. 'R': turn right 90 degrees. 3. After one pass: If (x, y) == (0, 0) OR direction != North: return true. Else: return false.