Partition List
Medium · Linked Lists · about 15 minutes
Asked at Amazon, Meta, Microsoft, Google, Bloomberg, JPMorgan Chase, Morgan Stanley.
Rearrange the list around the pivot x: every node with a value below x must end up ahead of every node whose value is x or more. Within each of the two groups, keep the nodes in the order they started in. Return the head.