The problem. Given the head of a singly linked list, reverse the list and return the new head. Every arrow should point the other way.
Input: head = [1, 2, 3, 4, 5]
Output: [5, 4, 3, 2, 1]
Input: head = [1, 2]
Output: [2, 1]
Input: head = []
Output: []Free account
Sign up to read the rest of this lesson: 5 more sections, 3 drawings, a dry-run simulator and code in JavaScript, Python, Java and C++.
Still to come