Problem
javascript
Array.prototype.splice()
1
1 | /** |
Submission Detail
- 113 / 113 test cases passed.
- Runtime: 76 ms, faster than 85.28% of JavaScript online submissions for Remove Element.
- Memory Usage: 38.6 MB, less than 69.26% of JavaScript online submissions for Remove Element.
2
1 | /** |
Submission Detail
- 113 / 113 test cases passed.
- Runtime: 80 ms, faster than 65.29% of JavaScript online submissions for Remove Element.
- Memory Usage: 38.6 MB, less than 48.89% of JavaScript online submissions for Remove Element.
3
© The Fastest Way to Remove a Specific Item from an Array in JavaScript
1 | /** |
Submission Detail
- 113 / 113 test cases passed.
- Runtime: 80 ms, faster than 65.29% of JavaScript online submissions for Remove Element.
- Memory Usage: 38.9 MB, less than 18.66% of JavaScript online submissions for Remove Element.
Two Pointers
Translation of © Solution - Approach 1: Two Pointers
1 | /** |
Submission Detail
- 113 / 113 test cases passed.
- Runtime: 76 ms, faster than 85.28% of JavaScript online submissions for Remove Element.
- Memory Usage: 38.7 MB, less than 48.89% of JavaScript online submissions for Remove Element.
Java
Two Pointers
1
© Solution - Approach 1: Two Pointers
1 | class Solution { |
Submission Detail
- 113 / 113 test cases passed.
- Runtime: 0 ms, faster than 100.00% of Java online submissions for Remove Element.
- Memory Usage: 37.6 MB, less than 48.38% of Java online submissions for Remove Element.
2
© Solution - Approach 2: Two Pointers - when elements to remove are rare
1 | class Solution { |
Submission Detail
- 113 / 113 test cases passed.
- Runtime: 0 ms, faster than 100.00% of Java online submissions for Remove Element.
- Memory Usage: 37.7 MB, less than 48.38% of Java online submissions for Remove Element.