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