Update 61. 扑克牌顺子.md

补充“解题思路”小节中通过排序、统计大小鬼数量来补齐空缺并判断顺子的文字说明。
This commit is contained in:
CyC2018
2026-10-30 20:18:07 +08:00
parent 6f12d532f0
commit 0ba7cc3d76
+2 -1
View File
@@ -10,9 +10,10 @@
<div align="center"> <img src="pics/offer-poker-straight.png" width="560px"/> </div><br>
## 解题思路
先排序,统计大小鬼(0)的个数 cnt。之后相邻的两张牌如果相同,就不可能组成顺子;不相同时,中间缺了 places[i + 1] - places[i] - 1 张牌,要用癞子补上。遍历完癞子还够用(cnt ≥ 0),就能组成顺子。
```java
public boolean checkDynasty(int[] places) {
if (places == null || places.length < 5)