86. Partition List
Practice Partition List for free on NudgeCode: Medium, Linked List pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
Rearrange a linked list so that every node with a value less than x comes before every node with a value greater than or equal to x. Within each of the two groups, nodes keep their original relative order. Return the head of the rearranged list.
Example
head = [1,4,3,2,5,2], x = 3 -> [1,2,2,4,3,5]
Constraints
- 0 <= length of the list <= 200
- -100 <= Node.val <= 100
- -200 <= x <= 200