public ListNode reverseList(ListNode head) {
ListNode crrNode = head;
ListNode preNode = null;
while (crrNode != null) {
ListNode nextNode = crrNode.next;
crrNode.next = preNode;
preNode = crrNode;
crrNode = nextNode;
}
return preNode;
}
LeetCode-Algorithms-[Easy][链表基础题]面试题24. 反转链表
猜你喜欢
转载自blog.csdn.net/m0_37302219/article/details/105533789
今日推荐
周排行