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