feat(content): function signatures + test cases
This commit is contained in:
@@ -10,6 +10,28 @@ categories:
|
||||
patterns:
|
||||
- greedy
|
||||
|
||||
function_signature: "def find_judge(n: int, trust: list[list[int]]) -> int:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { n: 2, trust: [[1, 2]] }
|
||||
expected: 2
|
||||
- input: { n: 3, trust: [[1, 3], [2, 3]] }
|
||||
expected: 3
|
||||
- input: { n: 3, trust: [[1, 3], [2, 3], [3, 1]] }
|
||||
expected: -1
|
||||
hidden:
|
||||
- input: { n: 1, trust: [] }
|
||||
expected: 1
|
||||
- input: { n: 2, trust: [] }
|
||||
expected: -1
|
||||
- input: { n: 4, trust: [[1, 3], [1, 4], [2, 3], [2, 4], [4, 3]] }
|
||||
expected: 3
|
||||
- input: { n: 3, trust: [[1, 2], [2, 3]] }
|
||||
expected: -1
|
||||
- input: { n: 4, trust: [[1, 2], [1, 3], [2, 1], [2, 3], [1, 4], [4, 3], [4, 1]] }
|
||||
expected: 3
|
||||
|
||||
description: |
|
||||
In a town, there are `n` people labeled from `1` to `n`. There is a rumor that one of these people is secretly the town judge.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user