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
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console