Leetcode:206. Reverse Linked List
这题直接ac掉
class Solution { public ListNode reverseList(ListNode head) { ListNode prev = null; while(head!=null) { ListNode tmp = head.next; head.next = prev; prev = head; head = tmp; } return prev; } }
posted on 2017-12-30 17:04 Michael2397 阅读(...) 评论(...) 编辑 收藏