LeetCode-Algorithms-[Easy][链表基础题]面试题24. 反转链表

面试题24. 反转链表

	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;
	}
发布了272 篇原创文章 · 获赞 7 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/m0_37302219/article/details/105533789