feat(content): function signatures + test cases

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

View File

@@ -9,6 +9,32 @@ categories:
patterns:
- greedy
function_signature: "def majority_element(nums: list[int]) -> list[int]:"
test_cases:
visible:
- input: { nums: [3, 2, 3] }
expected: [3]
- input: { nums: [1] }
expected: [1]
- input: { nums: [1, 2] }
expected: [1, 2]
hidden:
- input: { nums: [1, 1, 1, 2, 2, 3] }
expected: [1]
- input: { nums: [1, 2, 3, 4, 5] }
expected: []
- input: { nums: [2, 2, 2, 2] }
expected: [2]
- input: { nums: [1, 1, 2, 2, 3] }
expected: [1, 2]
- input: { nums: [0, 0, 0] }
expected: [0]
- input: { nums: [-1, -1, -1, 2, 2] }
expected: [-1]
- input: { nums: [1, 2, 1, 2, 1, 2, 3] }
expected: [1, 2]
description: |
Given an integer array of size `n`, find all elements that appear **more than** `⌊n/3⌋` times.