Remove Element

Easy
Arrays Array Two Pointers

Remove all occurrences of val from array. Print remaining elements space-separated.

Constraints

0 ≤ nums.length ≤ 100

Examples

Example 1:
Input: 3 2 2 3 3
Output: 2 2
Example 2:
Input: 0 1 2 2 3 0 4 2 2
Output: 0 1 3 0 4
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.