首页 > TAG信息列表 > 0206

LeetCode 0206 Reverse Linked List

原题传送门 1. 题目描述 2. Solution 1 1、思路分析 方法一: 遍历,逐个摘下结点,头插到新链表 2、代码实现 package Q0299.Q0206ReverseLinkedList; import DataStructure.ListNode; public class Solution1 { /* 方法一: 遍历,逐个摘下结点,头插到新链表 */

leetcode-0206 reverse-linked-list

Given the head of a singly linked list, reverse the list, and return the reversed list. Example 1: Input: head = [1,2,3,4,5] Output: [5,4,3,2,1] Example 2: Input: head = [1,2] Output: [2,1] Example 3: Input: head = [] Output: [] Constraints: The number o