# Leetcode 1275. Find winner on a tic tac toe game
圈圈叉叉遊戲只會有八種勝利結果,所以只要分別紀錄 A 和 B 有沒有在八條線內累積三個點,總共會需要16個空間
```python=
class Solution:
def tictactoe(self, moves: List[List[int]]) -> str:
# 0 A , 1 B
row, col = [[0 for _ in range(3)] for _ in range(2)], [[0 for _ in range(3)] for _ in range(2)]
d1, d2 = [0] * 2, [0] * 2
for i in range(len(moves)):
id = i % 2
r,c = moves[i]
row[id][r] += 1
col[id][c] += 1
d1[id] += r == c
d2[id] += r + c == 2
if 3 in (row[id][r], col[id][c], d1[id], d2[id]):
return 'AB'[id]
return 'Draw' if len(moves) == 9 else 'Pending'
```