Partition List Problem

Partition List Problem — ExecCode Medium DSA Practice

Solve the Partition List problem on ExecCode. Free online medium DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Partition a linked list so that all nodes less than x come before nodes greater than or equal to x, preserving relative order.

Examples

Input head = [1, 4, 3, 2, 5, 2], x = 3; Output [1, 2, 2, 4, 3, 5]

Constraints

1 ≤ n ≤ 10^5 Values fit interview constraints

Practice Partition List free on ExecCode. Browse DSA problems, topic map, and placement guides.