标签:
程序
public class ListReverse {
public ListNode reverseList(ListNode head) {
if (head == null) {
return head;
}
ListNode pre = head;
ListNode cur = pre.next;
while (cur != null) {
ListNode next = cur.next;
cur.next = pre;
pre = cur;
cur = next;
}
return pre;
}
}
标签:
原文地址:http://www.cnblogs.com/harrygogo/p/4629483.html