Skip to content

Commit 4f1b68f

Browse files
add solution 206[js]
1 parent cb52a4e commit 4f1b68f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const reverseList = function(head){
2+
if(head == null){
3+
return head;
4+
}
5+
let cur = head;
6+
let pre = null, tmp = null;
7+
while(cur != null){
8+
tmp = cur.next;
9+
cur.next = pre;
10+
pre = cur;
11+
cur = tmp;
12+
}
13+
return pre;
14+
}

0 commit comments

Comments
 (0)