feat(content): more test cases

This commit is contained in:
2025-07-13 19:25:39 +01:00
parent 98ebb1600f
commit 16b02451d0
94 changed files with 1840 additions and 0 deletions

View File

@@ -10,6 +10,28 @@ categories:
patterns:
- monotonic-stack
function_signature: "def eval_rpn(tokens: list[str]) -> int:"
test_cases:
visible:
- input: { tokens: ["2", "1", "+", "3", "*"] }
expected: 9
- input: { tokens: ["4", "13", "5", "/", "+"] }
expected: 6
- input: { tokens: ["10", "6", "9", "3", "+", "-11", "*", "/", "*", "17", "+", "5", "+"] }
expected: 22
hidden:
- input: { tokens: ["3"] }
expected: 3
- input: { tokens: ["1", "2", "+"] }
expected: 3
- input: { tokens: ["5", "1", "2", "+", "4", "*", "+", "3", "-"] }
expected: 14
- input: { tokens: ["15", "7", "1", "1", "+", "-", "/", "3", "*", "2", "1", "1", "+", "+", "-"] }
expected: 5
- input: { tokens: ["-78", "-33", "196", "+", "-19", "-", "115", "+", "-", "-99", "/", "-18", "8", "*", "-86", "-", "-", "16", "/", "26", "-14", "-", "-", "47", "-", "101", "-", "163", "*", "143", "-", "0", "-", "171", "+", "120", "*", "-60", "+", "156", "/", "173", "/", "-24", "11", "+", "21", "/", "*", "44", "*", "180", "70", "-", "-40", "*", "86", "132", "-", "-", "-126", "/", "-3", "170", "-", "-","-95", "-", "-", "153", "/", "-", "11", "+", "-60", "191", "-", "/", "-", "27", "/", "21", "/", "+", "/", "-89", "218", "-", "-", "7", "-", "-", "-27", "31", "*", "/", "23", "-", "-88", "123", "-", "-38", "/", "*", "-90", "-83", "/", "+", "-20", "+", "-31", "/", "-116", "79", "-", "*", "*", "238", "-69", "*", "-", "-", "192", "-", "/", "-", "170", "-", "59", "*", "37", "*", "-", "/", "-64", "139", "-", "-", "-58", "-", "25", "-11", "/", "/", "-", "-15", "*", "-", "39", "/", "-", "20", "-175", "/", "-114", "*", "-40", "*", "*", "17", "+", "+", "-10", "-", "*", "56", "/", "-", "-43", "-", "-104", "-", "+", "179", "/", "169", "-50", "-", "-52", "-10", "-", "+", "-", "247", "-192", "+", "-24", "-117", "-", "-51", "-", "/", "-", "+", "/", "*"] }
expected: 2
description: |
You are given an array of strings `tokens` that represents an arithmetic expression in a [Reverse Polish Notation](http://en.wikipedia.org/wiki/Reverse_Polish_notation).