File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 204204 - [ 0799. 香槟塔] ( ./problems/799.champagne-tower.md ) 👍
205205 - [ 0801. 使序列递增的最小交换次数] ( ./problems/801.minimum-swaps-to-make-sequences-increasing.md ) 👍
206206 - [ 0816. 模糊坐标] ( ./problems/816.ambiguous-coordinates.md ) 👍
207- - [ 0820. 单词的压缩编码] ( ./problems/820.short-encoding-of-words.md ) 👍
207+ - [ 0820. 单词的压缩编码] ( ./problems/820.short-encoding-of-words.md )
208208 - [ 0873. 最长的斐波那契子序列的长度] ( ./problems/873.length-of-longest-fibonacci-subsequence.md ) 👍
209209 - [ 0875. 爱吃香蕉的珂珂] ( ./problems/875.koko-eating-bananas.md )
210- - [ 0877. 石子游戏] ( ./problems/877.stone-game.md ) 👍
210+ - [ 0877. 石子游戏] ( ./problems/877.stone-game.md )
211211 - [ 0886. 可能的二分法] ( ./problems/886.possible-bipartition.md )
212212 - [ 0898. 子数组按位或操作] ( ./problems/898.bitwise-ors-of-subarrays.md ) 👍
213213 - [ 0900. RLE 迭代器] ( ./problems/900.rle-iterator.md ) 👍
Original file line number Diff line number Diff line change @@ -58,11 +58,11 @@ n 块石头放置在二维平面中的一些整数坐标点上。每个坐标点
5858
5959继续分析下题目。 题目的意思是任意一个石头可以消除和它同行和同列的其他石子。于是我就想象出了下面这样一幅图,其中红色的方块表示石子,方块的连线表示离得最近的可以消除的石子。实际上,一个石子除了可以消除图中线条直接相连的石子,还可以消除邻居的邻居。** 这提示我们使用并查集维护这种联通关系** ,联通的依据自然就是列或者行一样。
6060
61- ![ ] ( https://pic.leetcode-cn.com/1610681616-aINVVn-008eGmZEly1gmo7njo2ksj30o00li75y .jpg )
61+ ![ ] ( https://tva1.sinaimg.cn/large/008i3skNly1gq8w3hl3hfj30o00li0ts .jpg )
6262
6363上面是一个全联通的图。如下是有两个联通域的图。
6464
65- ![ ] ( https://pic.leetcode-cn.com/1610681616-tQEKNR-008eGmZEly1gmo7ryay3pj30og0lw0tp .jpg )
65+ ![ ] ( https://tva1.sinaimg.cn/large/008i3skNly1gq8w3os5ngj30og0lwmxw .jpg )
6666
6767有了上面的知识,其实就可以将石子全部建立并查集的联系,并计算联通子图的个数。答案就是 n - 联通子图的个数,其中 n 为 stones 的长度。
6868
You can’t perform that action at this time.
0 commit comments