Skip to content

Commit 609212c

Browse files
committed
fix: lint error
1 parent 5c64755 commit 609212c

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed
Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
// Definition for singly-linked list.
22
class ListNode {
3-
val: number
4-
next: ListNode | null
5-
constructor(val?: number, next?: ListNode | null) {
6-
this.val = (val===undefined ? 0 : val)
7-
this.next = (next===undefined ? null : next)
8-
}
3+
val: number;
4+
next: ListNode | null;
5+
constructor(val?: number, next?: ListNode | null) {
6+
this.val = val === undefined ? 0 : val;
7+
this.next = next === undefined ? null : next;
8+
}
99
}
1010

1111
function reverseList(head: ListNode | null): ListNode | null {
12-
let prev: ListNode | null = null;
13-
let current = head;
14-
let next = null;
12+
let prev: ListNode | null = null;
13+
let current = head;
14+
let next = null;
1515

16-
while (current !== null) {
17-
const next = current.next; // 1. ๋‹ค์Œ ๋…ธ๋“œ๋ฅผ ๊ธฐ์–ตํ•ด๋‘๊ณ 
18-
current.next = prev; // 2. ํ˜„์žฌ ๋…ธ๋“œ๊ฐ€ ์ด์ „ ๋…ธ๋“œ๋ฅผ ๊ฐ€๋ฆฌํ‚ค๋„๋ก
19-
prev = current; // 3. ์ด์ „ ๋…ธ๋“œ๋ฅผ ์ง€๊ธˆ ๋…ธ๋“œ๋กœ ์—…๋ฐ์ดํŠธ
20-
current = next; // 4. ํ˜„์žฌ ๋…ธ๋“œ๋ฅผ ๋‹ค์Œ ๋…ธ๋“œ๋กœ ์ด๋™
21-
}
16+
while (current !== null) {
17+
const next = current.next; // 1. ๋‹ค์Œ ๋…ธ๋“œ๋ฅผ ๊ธฐ์–ตํ•ด๋‘๊ณ 
18+
current.next = prev; // 2. ํ˜„์žฌ ๋…ธ๋“œ๊ฐ€ ์ด์ „ ๋…ธ๋“œ๋ฅผ ๊ฐ€๋ฆฌํ‚ค๋„๋ก
19+
prev = current; // 3. ์ด์ „ ๋…ธ๋“œ๋ฅผ ์ง€๊ธˆ ๋…ธ๋“œ๋กœ ์—…๋ฐ์ดํŠธ
20+
current = next; // 4. ํ˜„์žฌ ๋…ธ๋“œ๋ฅผ ๋‹ค์Œ ๋…ธ๋“œ๋กœ ์ด๋™
21+
}
2222

23-
24-
return prev;
25-
};
23+
return prev;
24+
}

0 commit comments

Comments
ย (0)