Skip to content

Commit a61f1d5

Browse files
authored
feat: update ts solution to lc problem: No.0141 (doocs#1349)
1 parent e0b5e16 commit a61f1d5

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

solution/0100-0199/0141.Linked List Cycle/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func hasCycle(head *ListNode) bool {
200200
function hasCycle(head: ListNode | null): boolean {
201201
const set = new Set<ListNode>();
202202
let node = head;
203-
while (node != null) {
203+
while (node !== null) {
204204
if (set.has(node)) {
205205
return true;
206206
}
@@ -227,7 +227,7 @@ function hasCycle(head: ListNode | null): boolean {
227227
function hasCycle(head: ListNode | null): boolean {
228228
let slow = head;
229229
let fast = head;
230-
while (fast != null && fast.next != null) {
230+
while (fast !== null && fast.next !== null) {
231231
slow = slow.next;
232232
fast = fast.next.next;
233233
if (slow === fast) {

solution/0100-0199/0141.Linked List Cycle/README_EN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func hasCycle(head *ListNode) bool {
169169
function hasCycle(head: ListNode | null): boolean {
170170
const set = new Set<ListNode>();
171171
let node = head;
172-
while (node != null) {
172+
while (node !== null) {
173173
if (set.has(node)) {
174174
return true;
175175
}
@@ -196,7 +196,7 @@ function hasCycle(head: ListNode | null): boolean {
196196
function hasCycle(head: ListNode | null): boolean {
197197
let slow = head;
198198
let fast = head;
199-
while (fast != null && fast.next != null) {
199+
while (fast !== null && fast.next !== null) {
200200
slow = slow.next;
201201
fast = fast.next.next;
202202
if (slow === fast) {

solution/0100-0199/0141.Linked List Cycle/Solution.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
function hasCycle(head: ListNode | null): boolean {
1414
let slow = head;
1515
let fast = head;
16-
while (fast != null && fast.next != null) {
16+
while (fast !== null && fast.next !== null) {
1717
slow = slow.next;
1818
fast = fast.next.next;
1919
if (slow === fast) {

0 commit comments

Comments
 (0)