Question
Given the head
of a singly linked list, reverse the list, and return the reversed list.
https://leetcode.com/problems/reverse-linked-list/
- Solution1
1 | class Solution { |
Complexity:
Time complexity: O(n)
Space complexity: O(1)
Given the head
of a singly linked list, reverse the list, and return the reversed list.
https://leetcode.com/problems/reverse-linked-list/
1 | class Solution { |
Complexity:
Time complexity: O(n)
Space complexity: O(1)
Welcome to my other publishing channels