Skip to main content

Most Stones Removed with Same Row or Column

描述​

TODO

分析​

这是一个典型的并查集问题,先把 class DSU 模版抄一遍,接下来核心逻辑只需要几行:把所有的石头暴力两两组合,如果二者在同一行或者同一列,则合并,因此时间复杂度为 O(N2×log⁡∗N)O(N^2 \times \log^* N)。

代码​

# Empty file - nothing to translate since only comment is "TODO"

# Note: Python uses '#' for comments instead of '//'
# TODO