head and an integer pivot. Rearrange the nodes so that every node with a value less than pivot comes before every node with a value greater than or equal to pivot.
Within each of the two groups, nodes must keep their original relative order.
Return the head of the resulting list. An empty list stays empty.head=list_node([6, 2, 9, 1, 5]), pivot=5 → [2, 1, 6, 9, 5]
Only 2 and 1 are below 5; they come first in their original order, followed by 6, 9, 5, also in their original order.
head=list_node([-3, 4, -3]), pivot=0 → [-3, -3, 4]
Both −3 values are below zero and move to the front; the 4 stays at the end.
head=list_node([]), pivot=7 → None
head=list_node([6, 2, 9, 1, 5]), pivot=5
[2, 1, 6, 9, 5]
Run checks the first 3 tests in your browser. Submit checks all 104 tests on the server, hidden ones included.