反转链表
题目描述

实现
public class reverseLinkedList {
public ListNode ReverseList(ListNode head) { if (head == null) { return null; } ListNode pre = null; ListNode now = head; while (now!= null) { ListNode nextNode = now.next; now.next = pre; pre = now; now = nextNode; } return pre; } }
|
版权声明: 此文章版权归Chankeitin所有,如有转载,请註明来自原作者
打赏

wechat

alipay