Last active
November 3, 2018 07:53
-
-
Save phongngtuan/6c27b35169699c535513dd90f81fbcda to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public ListNode reverseList(ListNode head) { | |
| if (head == null) return head; | |
| ListNode curr = head.next; | |
| head.next = null; | |
| while (curr != null) { | |
| ListNode next = curr.next; | |
| curr.next = head; | |
| head = curr; | |
| curr = next; | |
| } | |
| return head; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment