Dev
Mentor
Coach Interview AI
Mock Interview AI
Coding Problems
Blog
Pricing
Toggle theme
Sign In
Get Started
Toggle theme
Loading...
Loading...
For the best coding experience, use a desktop browser.
Easy
Two Pointers
Remove Element
Examples
Input:
nums = [3,2,2,3], val = 3
Output:
2
Sample Test Cases
Case 1 Input:
[3,2,2,3] 3
Expected:
2
Case 2 Input:
[0,1,2,2,3,0,4,2] 2
Expected:
5
Reset
Run
Submit
Loading editor...
Test Case
Output
Submission
Case 1 Input:
[3,2,2,3] 3
Expected:
2
Case 2 Input:
[0,1,2,2,3,0,4,2] 2
Expected:
5
Remove all instances of
val
in-place and return the new length.