1
# Runtime: 187 ms (Top 84.32%) | Memory: 18.9 MB (Top 5.06%)3
def removeStones(self, stones: List[List[int]]) -> int:7
seen[(row, col)] = True8
for r, c in tableRow[row]:10
for r, c in tableCol[col]:14
tableRow, tableCol = {}, {}15
for row, col in stones:16
if row not in tableRow:18
if col not in tableCol:20
tableRow[row].add((row, col))21
tableCol[col].add((row, col))23
count, seen = 0, {(row, col): False for row, col in stones}24
for row, col in stones:25
count += dfs(row, col)26
return abs(len(stones) - count)