Leecode 0206. Reverse Linked List
206. Reverse Linked ListGiven the head of a singly linked list, reverse the list, and return the reversed list. Example 1: 12Input: head = [1,2,3,4,5]Output: [5,4,3,2,1] Example 2: 12Input: head = [1,2]Output: [2,1] Example 3: 12Input: head = []Output: [] Constraints: The number of nodes in the list is the range [0, 5000]. -5000 <= Node.val <= 5000 解法 1:迭代解法123456789101112131415161718192021222324252627/** * Definition for singly-linked list. * struct ListNode { * int...


Categories
Tags
Archives
- 2024年08月 6
- 2024年07月 5
- 2024年06月 5
- 2024年05月 6
- 2024年04月 6
- 2024年03月 6
- 2024年02月 4
- 2024年01月 6
- 2023年12月 5
- 2023年11月 6
- 2023年10月 5
- 2023年09月 4
- 2023年08月 4
- 2023年07月 6
- 2023年06月 5
- 2023年05月 7
- 2023年04月 16
- 2023年03月 16
- 2023年02月 13
- 2023年01月 15
- 2022年12月 6
- 2022年11月 11
- 2022年10月 7
- 2022年09月 4
- 2022年08月 3
- 2022年07月 5
- 2022年06月 7
- 2022年05月 4
- 2022年04月 4
- 2022年03月 4
- 2022年02月 5
- 2022年01月 5
Website Info
Article Count :
211
Runtime :
Total Word Count :
368.9k
Last Update :