feat(content): function signatures + test cases
This commit is contained in:
@@ -9,6 +9,24 @@ categories:
|
||||
patterns:
|
||||
- monotonic-stack
|
||||
|
||||
function_signature: "class MyStack"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { operations: ["MyStack", "push", "push", "top", "pop", "empty"], arguments: [[], [1], [2], [], [], []] }
|
||||
expected: [null, null, null, 2, 2, false]
|
||||
hidden:
|
||||
- input: { operations: ["MyStack", "push", "top"], arguments: [[], [5], []] }
|
||||
expected: [null, null, 5]
|
||||
- input: { operations: ["MyStack", "push", "push", "push", "pop", "pop", "pop"], arguments: [[], [1], [2], [3], [], [], []] }
|
||||
expected: [null, null, null, null, 3, 2, 1]
|
||||
- input: { operations: ["MyStack", "push", "pop", "push", "pop"], arguments: [[], [1], [], [2], []] }
|
||||
expected: [null, null, 1, null, 2]
|
||||
- input: { operations: ["MyStack", "empty"], arguments: [[], []] }
|
||||
expected: [null, true]
|
||||
- input: { operations: ["MyStack", "push", "push", "pop", "push", "top"], arguments: [[], [1], [2], [], [3], []] }
|
||||
expected: [null, null, null, 2, null, 3]
|
||||
|
||||
description: |
|
||||
Implement a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal stack (`push`, `top`, `pop`, and `empty`).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user