DevJourney · code I wrote while learning

Remove Target Element from List

2 items

README.md

Single File Programming Question

Problem Statement

Alex is creating a basic program for integer list management. The program allows users to input a list of numbers and a target number for removal. The removeElement function, utilizing the List Container, must delete all instances of the target number.

Assist Alex in completing the program.

Input format :

The first line consists of an integer N, representing the size of the list.

The second line consists of N space-separated integers, representing the elements of the list.

The third line consists of an integer, representing the target number to be removed.

Output format :

The output prints the remaining list elements after removing the target number.

If the target element is not found, print the list of elements.

Refer to the sample output for formatting specifications.

Code constraints :

1 ≤ N ≤ 10

1 ≤ elements ≤ 100

1 ≤ target ≤100

Sample test cases :

Input 1 :

3 1 2 3 2

Output 1 :

1 3

Input 2 :

8 93 42 56 78 93 95 93 37 93

Output 2 :

42 56 78 95 37

Input 3 :

4 34 56 78 93 49

Output 3 :

34 56 78 93