feat(content): function signatures + test cases

This commit is contained in:
2025-07-13 19:53:34 +01:00
parent b434eb3a49
commit a7d29b7cce
203 changed files with 4526 additions and 0 deletions

View File

@@ -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`).