feat(content): function signatures + test cases
This commit is contained in:
@@ -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*.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user