解題說明
C++ 解法
複雜度分析
虛擬碼
1. Initialize qR, qD with indices of 'R' and 'D' senators 2. n = len(senate) 3. While qR and qD are both non-empty: a. r = qR.front(), pop; d = qD.front(), pop b. If r < d: qR.push(r + n) // R eliminates D c. Else: qD.push(d + n) // D eliminates R 4. If qR is empty: return "Dire" 5. Else: return "Radiant"