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

@@ -10,6 +10,30 @@ categories:
patterns:
- monotonic-stack
function_signature: "def calculate(s: str) -> int:"
test_cases:
visible:
- input: { s: "1 + 1" }
expected: 2
- input: { s: " 2-1 + 2 " }
expected: 3
- input: { s: "(1+(4+5+2)-3)+(6+8)" }
expected: 23
hidden:
- input: { s: "1" }
expected: 1
- input: { s: "-1" }
expected: -1
- input: { s: "-(3+2)" }
expected: -5
- input: { s: "1-(5)" }
expected: -4
- input: { s: "2147483647" }
expected: 2147483647
- input: { s: "1-(-2)" }
expected: 3
description: |
Given a string `s` representing a valid expression, implement a basic calculator to evaluate it, and return *the result of the evaluation*.