206. Reverse Linked List

Practice Reverse Linked List for free on NudgeCode: Easy, Linked List pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Reverse a singly linked list and return the new head.

Example

head = [1,2,3,4,5]  ->  [5,4,3,2,1]

Constraints