You're given the head of a singly linked list. Your task is to reverse it and return the new head.
For 1→2→3→4→5, you'd return 5→4→3→2→1. Every pointer now points backward.
Before coding, think: as you traverse the list, what information do you need to keep track of? You can't look backward in a singly linked list, so how do you remember where you came from?
Constraints: list length , node values from to .