Remove Element Problem
Remove Element Problem — ExecCode Easy DSA Practice
Solve the Remove Element problem on ExecCode. Free online easy DSA practice in Two Pointers. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Remove every occurrence of val from nums in place. Let read scan every element and let write mark the next slot where a kept value should be placed.
Examples
Input nums = [3,2,2,3], val = 3; Output 2. Input nums = [0,1,2,2,3,0,4,2], val = 2; Output 5
Constraints
0 <= nums.length <= 100 0 <= nums[i] <= 50 0 <= val <= 100
Practice Remove Element free on ExecCode. Browse DSA problems, topic map, and placement guides.