package Leetcode真题分门别类.链表;
import 玩转数据结构.链表看递归.移除链表元素.ListNode;
public class _206反转链表 {
public ListNode reverseList(ListNode head) {
ListNode prev = null;
ListNode curr = head;
while (curr != null) {
ListNode nextTemp = curr.next;
curr.next = prev;
prev = curr;
curr = nextTemp;
}
return prev;
}
}