Given the head of a singly linked list, reverse the list and return its new head.
A node is ListNode { val int next ListNode? } (an empty list is null).
Example
1 -> 2 -> 3 -> 4 -> 5 => 5 -> 4 -> 3 -> 2 -> 1
function ReverseList(head: ListNode?) -> ListNode?
Found a bug? Or annoyed about something in the language? Tell us.