File tree 3 files changed +5
-5
lines changed
solution/0100-0199/0141.Linked List Cycle
3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -200,7 +200,7 @@ func hasCycle(head *ListNode) bool {
200
200
function hasCycle(head : ListNode | null ): boolean {
201
201
const set = new Set <ListNode >();
202
202
let node = head ;
203
- while (node != null ) {
203
+ while (node !== null ) {
204
204
if (set .has (node )) {
205
205
return true ;
206
206
}
@@ -227,7 +227,7 @@ function hasCycle(head: ListNode | null): boolean {
227
227
function hasCycle(head : ListNode | null ): boolean {
228
228
let slow = head ;
229
229
let fast = head ;
230
- while (fast != null && fast .next != null ) {
230
+ while (fast !== null && fast .next != = null ) {
231
231
slow = slow .next ;
232
232
fast = fast .next .next ;
233
233
if (slow === fast ) {
Original file line number Diff line number Diff line change @@ -169,7 +169,7 @@ func hasCycle(head *ListNode) bool {
169
169
function hasCycle(head : ListNode | null ): boolean {
170
170
const set = new Set <ListNode >();
171
171
let node = head ;
172
- while (node != null ) {
172
+ while (node !== null ) {
173
173
if (set .has (node )) {
174
174
return true ;
175
175
}
@@ -196,7 +196,7 @@ function hasCycle(head: ListNode | null): boolean {
196
196
function hasCycle(head : ListNode | null ): boolean {
197
197
let slow = head ;
198
198
let fast = head ;
199
- while (fast != null && fast .next != null ) {
199
+ while (fast !== null && fast .next != = null ) {
200
200
slow = slow .next ;
201
201
fast = fast .next .next ;
202
202
if (slow === fast ) {
Original file line number Diff line number Diff line change 13
13
function hasCycle ( head : ListNode | null ) : boolean {
14
14
let slow = head ;
15
15
let fast = head ;
16
- while ( fast != null && fast . next != null ) {
16
+ while ( fast !== null && fast . next != = null ) {
17
17
slow = slow . next ;
18
18
fast = fast . next . next ;
19
19
if ( slow === fast ) {
You can’t perform that action at this time.
0 commit comments