Problem
Given the head of a singly linked list, reverse the list and return the new head. Each node contains an integer value and a next pointer. You must reverse the links in-place rather than creating a second list.
Constraints
- 0 <= number of nodes <= 5000
- -5000 <= Node.val <= 5000
- The list is singly linked
Function Signature
def reverse_linked_list(head):
Practicing as: Security Engineer interview at PwCHi, I'll play your PwC interviewer for the Security Engineer role. Candidates describe these interviews as mixed and on the easier side, so expect me to be professional and fair. Take your time with the question above and answer like we're in the room.
You are practicing as a guest. Sign up free to run your code against the sample data. Your draft stays right here.


