From 23d21cdfd4fa7f4314ffed5f0b2281a9f5c9412c Mon Sep 17 00:00:00 2001 From: CyC2018 Date: Wed, 28 Oct 2026 13:45:07 +0800 Subject: [PATCH] =?UTF-8?q?Update=2061.=20=E6=89=91=E5=85=8B=E7=89=8C?= =?UTF-8?q?=E9=A1=BA=E5=AD=90.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 题目链接改为力扣中的对应题目,题目描述和代码按该题的接口调整。 --- notes/61. 扑克牌顺子.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/notes/61. 扑克牌顺子.md b/notes/61. 扑克牌顺子.md index 9948e0dc..002d695e 100644 --- a/notes/61. 扑克牌顺子.md +++ b/notes/61. 扑克牌顺子.md @@ -2,7 +2,7 @@ ## 题目链接 -[NowCoder](https://www.nowcoder.com/practice/762836f4d43d43ca9deb273b3de8e1f4?tpId=13&tqId=11198&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking&from=cyc_github) +[Leetcode](https://leetcode.cn/problems/bu-ke-pai-zhong-de-shun-zi-lcof/) ## 题目描述 @@ -14,24 +14,23 @@ ## 解题思路 ```java -public boolean isContinuous(int[] nums) { - - if (nums.length < 5) +public boolean checkDynasty(int[] places) { + if (places == null || places.length < 5) return false; - Arrays.sort(nums); + Arrays.sort(places); // 统计癞子数量 int cnt = 0; - for (int num : nums) - if (num == 0) + for (int place : places) + if (place == 0) cnt++; // 使用癞子去补全不连续的顺子 - for (int i = cnt; i < nums.length - 1; i++) { - if (nums[i + 1] == nums[i]) + for (int i = cnt; i < places.length - 1; i++) { + if (places[i + 1] == places[i]) return false; - cnt -= nums[i + 1] - nums[i] - 1; + cnt -= places[i + 1] - places[i] - 1; } return cnt >= 0;