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 阅读(141) 评论(0) 收藏 举报
浙公网安备 33010602011771号