206. Reverse Linked List
Description
See: https://leetcode.com/problems/reverse-linked-list/
Solution
Standard reverse a linked list question. Implemented both iteratively and recursively.
Iterative
Time complexity: O(n)
Space complexity: O(1)
Recursive
Time complexity: O(n)
Space complexity: O(n) - recursive stack is the size of the linked list
Last updated