prev and curr, where prev points to the head of the list and curr points to the second node.curr is not null.curr.val is negative, perform the following steps:
a. Detach curr from its current position by setting prev.next to curr.next.
b. Move curr to the head of the list by setting curr.next to head and then updating head to curr.
c. Update curr to the next node in the list, which is now prev.next.curr.val is non-negative, simply move both prev and curr to the next nodes in the list.curr reaches the end of the list.head of the list.