The Zeta mobile app stores a user's activity feed as a singly linked list. Given the head of the list, reverse the list in place and return the new head so the feed displays the newest node first.
Implement reverse_list(head):
head, either None or a reference to the first ListNode in a singly linked list. Each node has integer field val and pointer field next.next pointer. The original nodes must be reused, and no new list nodes may be created.[1, 2, 3] represents 1 -> 2 -> 3.def reverse_list(head):