feat(content): more test cases

This commit is contained in:
2025-07-13 19:25:39 +01:00
parent 98ebb1600f
commit 16b02451d0
94 changed files with 1840 additions and 0 deletions

View File

@@ -9,6 +9,24 @@ categories:
patterns:
- two-pointers
function_signature: "def remove_element(nums: list[int], val: int) -> int:"
test_cases:
visible:
- input: { nums: [3, 2, 2, 3], val: 3 }
expected: 2
- input: { nums: [0, 1, 2, 2, 3, 0, 4, 2], val: 2 }
expected: 5
- input: { nums: [1], val: 1 }
expected: 0
hidden:
- input: { nums: [], val: 0 }
expected: 0
- input: { nums: [1, 2, 3, 4, 5], val: 6 }
expected: 5
- input: { nums: [4, 4, 4, 4], val: 4 }
expected: 0
description: |
Given an integer array `nums` and an integer `val`, remove all occurrences of `val` in `nums` **in-place**. The order of the elements may be changed. Then return *the number of elements in* `nums` *which are not equal to* `val`.