LeetCode142环形链表II:为何如此设定循环条件?

内容概览
探讨LeetCode142题中,环形链表II的while循环判断条件,理解为什么采用'fast != NULL && fast->next != NULL'而非'fast->next!=NULL&&fast->next->next!=NULL',以及错误'runtime error: member access within null pointer'的解析。
啊哈
2024-03-12 11:17
赞4
求问leetcode142环形链表II 为什么while循环的判断是 while(fast != NULL && fast->next != NULL)而不是while(fast->next!=NULL&&fast->next->next!=NULL)啊,我按照后面的判断语句会报错Line 19: Char 46: runtime error: member access within null pointer of type 'ListNode' (solution.cpp...

代码随想录

星球已运营 5 年零 283 天

累计超过  45000+  位成员加入

4小时前

最近更新

180000+

内容数

进入星球主页