feat(content): function signatures + test cases

This commit is contained in:
2025-07-13 19:53:34 +01:00
parent d65ccf7dc2
commit 0262ca8bf6
203 changed files with 4526 additions and 0 deletions

View File

@@ -9,6 +9,30 @@ categories:
patterns:
- sliding-window
function_signature: "def contains_nearby_duplicate(nums: list[int], k: int) -> bool:"
test_cases:
visible:
- input: { nums: [1, 2, 3, 1], k: 3 }
expected: true
- input: { nums: [1, 0, 1, 1], k: 1 }
expected: true
- input: { nums: [1, 2, 3, 1, 2, 3], k: 2 }
expected: false
hidden:
- input: { nums: [1], k: 1 }
expected: false
- input: { nums: [1, 1], k: 0 }
expected: false
- input: { nums: [1, 2, 1], k: 2 }
expected: true
- input: { nums: [99, 99], k: 2 }
expected: true
- input: { nums: [1, 2, 3, 4, 5], k: 3 }
expected: false
- input: { nums: [0, 1, 2, 3, 4, 0, 0, 7, 8, 9, 10, 11, 12, 0], k: 1 }
expected: true
description: |
Given an integer array `nums` and an integer `k`, return `true` *if there are two **distinct indices*** `i` *and* `j` *in the array such that* `nums[i] == nums[j]` *and* `abs(i - j) <= k`.