feat(content): function signatures + test cases
This commit is contained in:
@@ -9,6 +9,44 @@ categories:
|
||||
patterns:
|
||||
- heap
|
||||
|
||||
function_signature: "class FreqStack: def __init__(self); def push(self, val: int) -> None; def pop(self) -> int"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input:
|
||||
operations: ["FreqStack", "push", "push", "push", "push", "push", "push", "pop", "pop", "pop", "pop"]
|
||||
arguments: [[], [5], [7], [5], [7], [4], [5], [], [], [], []]
|
||||
expected: [null, null, null, null, null, null, null, 5, 7, 5, 4]
|
||||
- input:
|
||||
operations: ["FreqStack", "push", "push", "push", "pop", "pop"]
|
||||
arguments: [[], [1], [1], [1], [], []]
|
||||
expected: [null, null, null, null, 1, 1]
|
||||
hidden:
|
||||
- input:
|
||||
operations: ["FreqStack", "push", "pop"]
|
||||
arguments: [[], [10], []]
|
||||
expected: [null, null, 10]
|
||||
- input:
|
||||
operations: ["FreqStack", "push", "push", "push", "pop", "push", "pop"]
|
||||
arguments: [[], [1], [2], [3], [], [1], []]
|
||||
expected: [null, null, null, null, 3, null, 1]
|
||||
- input:
|
||||
operations: ["FreqStack", "push", "push", "push", "push", "pop", "pop"]
|
||||
arguments: [[], [5], [5], [5], [5], [], []]
|
||||
expected: [null, null, null, null, null, 5, 5]
|
||||
- input:
|
||||
operations: ["FreqStack", "push", "push", "push", "push", "push", "pop", "pop", "pop"]
|
||||
arguments: [[], [1], [2], [1], [2], [1], [], [], []]
|
||||
expected: [null, null, null, null, null, null, 1, 2, 1]
|
||||
- input:
|
||||
operations: ["FreqStack", "push", "push", "push", "push", "push", "push", "pop", "push", "pop", "pop"]
|
||||
arguments: [[], [4], [0], [9], [3], [4], [2], [], [6], [], []]
|
||||
expected: [null, null, null, null, null, null, null, 4, null, 6, 2]
|
||||
- input:
|
||||
operations: ["FreqStack", "push", "push", "pop", "push", "pop", "push", "pop"]
|
||||
arguments: [[], [1], [1], [], [2], [], [2], []]
|
||||
expected: [null, null, null, 1, null, 2, null, 2]
|
||||
|
||||
description: |
|
||||
Design a stack-like data structure to push elements to the stack and pop the most frequent element from the stack.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user