You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/**It works out the best to set up a debug point and visualize this process:
14
18
* e.g. 1->2->3-null
@@ -26,30 +30,22 @@ public ListNode reverseList_iterative(ListNode head) {
26
30
returnnewHead;
27
31
}
28
32
29
-
//following the above iterative version, the recursive solution flows out so naturally, basically, we just replaced the while loop with a recursive function
30
-
//still, a null newHead proves to be very helpful.
33
+
/**
34
+
* following the above iterative version, the recursive solution flows out so naturally, basically, we just replaced the while loop with a recursive function
35
+
* still, a null newHead proves to be very helpful.
//the above recursive function could of course be shortened to below, but the above one is just more intuitive and easier to follow and sort out your logic
0 commit comments