Delete All Occurrences Problem

Delete All Occurrences Problem — ExecCode Easy DSA Practice

Solve the Delete All Occurrences 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 Delete All Occurrences. Your task is to compute the required answer and return modified list values, space-separated. A number or sequence is stored node by node. In Delete All Occurrences, each step must preserve the order of nodes while solving the required operation. data: N, N node values, then X.

Examples

Input {"data": "5\n1\n2\n3\n2\n5\n2"}; Output 1 3 5. Input {"data": "3\n1\n2\n3\n4"}; Output 1 2 3

Constraints

1 <= nodes <= 10^4

Practice Delete All Occurrences free on ExecCode. Browse DSA problems, topic map, and placement guides.