feat(content): function signatures + test cases
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user