Reverse a singly linked list and return the new head. Input format The list is given as a JSON array of its values, e.g. [[1,2,3,4,5]] . Your method receives the head ListNode (with .val and .next ); ListNode is predefined.