We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 08b5ce9 commit c016a97Copy full SHA for c016a97
Leetcode/easy/ReverseLinkedList206.java
@@ -19,6 +19,7 @@ private class ListNode {
19
}
20
21
22
+ // O(N) Time | O(1) Space
23
public ListNode reverseList1(ListNode head) {
24
25
ListNode newHead = null;
@@ -32,6 +33,7 @@ public ListNode reverseList1(ListNode head) {
32
33
return newHead;
34
35
36
+ // O(N) Time | O(N) Space
37
public ListNode reverseList(ListNode head) {
38
39
if (head == null || head.next == null) {
0 commit comments