Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 2-哈希/3-0129-最长连续序列.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public int longestConsecutive(int[] nums) {
int maxLength = 0;

// 遍历每个数字
for (int num : nums) {
for (int num : set) {
// 如果num-1存在,说明num不是序列的起点,跳过
if (!set.contains(num - 1)) {
int currentNum = num;
Expand Down Expand Up @@ -170,4 +170,4 @@ public int longestConsecutive(int[] nums) {

---
作者:忍者算法
公众号:忍者算法
公众号:忍者算法