Sort a Linked List of 0s 1s and 2s Problem

Sort a Linked List of 0s 1s and 2s Problem — ExecCode Easy DSA Practice

Solve the Sort a Linked List of 0s 1s and 2s problem on ExecCode. Free online easy DSA practice in Linked List. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given the input needed to solve Sort a Linked List of 0s 1s and 2s. Your task is to compute the required answer and return sorted JSON array string. A number or sequence is stored node by node. In Sort a Linked List of 0s 1s and 2s, each step must preserve the order of nodes while solving the required operation. JSON nums array.

Examples

Input {"nums": [2, 1, 0, 1, 2]}; Output [0, 1, 1, 2, 2]

Constraints

Three-way partition

Practice Sort a Linked List of 0s 1s and 2s free on ExecCode. Browse DSA problems, topic map, and placement guides.