上班摸鱼刷算法-Java-hot100-[206]反转链表
class Solution { public ListNode reverseList(ListNode head) { if (head == null || head.next == null) { return head; } ListNode preNode = null; ListNode nextNode = head; while (head != null) { nextNode = head.next; head.next = preNode; preNode = head; head = nextNode; } return preNode; }