1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-04 23:11:41 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -11,8 +11,8 @@
"translatedContent": null,
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 384,
"dislikes": 299,
"likes": 386,
"dislikes": 305,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Ternary Expression Parser\", \"titleSlug\": \"ternary-expression-parser\", \"difficulty\": \"Medium\", \"translatedTitle\": null}, {\"title\": \"Number of Atoms\", \"titleSlug\": \"number-of-atoms\", \"difficulty\": \"Hard\", \"translatedTitle\": null}, {\"title\": \"Basic Calculator IV\", \"titleSlug\": \"basic-calculator-iv\", \"difficulty\": \"Hard\", \"translatedTitle\": null}]",
"exampleTestcases": "\"(let x 2 (mult x (let x 3 y 4 (add x y))))\"\n\"(let x 3 x 2 x)\"\n\"(let x 1 y 2 x (add x y) (add x y))\"",
@@ -155,7 +155,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"18.3K\", \"totalSubmission\": \"35.7K\", \"totalAcceptedRaw\": 18286, \"totalSubmissionRaw\": 35672, \"acRate\": \"51.3%\"}",
"stats": "{\"totalAccepted\": \"18.4K\", \"totalSubmission\": \"36K\", \"totalAcceptedRaw\": 18427, \"totalSubmissionRaw\": 36006, \"acRate\": \"51.2%\"}",
"hints": [
"* If the expression starts with a digit or '-', it's an integer: return it.\r\n\r\n* If the expression starts with a letter, it's a variable. Recall it by checking the current scope in reverse order.\r\n\r\n* Otherwise, group the tokens (variables or expressions) within this expression by counting the \"balance\" `bal` of the occurrences of `'('` minus the number of occurrences of `')'`. When the balance is zero, we have ended a token. For example, `(add 1 (add 2 3))` should have tokens `'1'` and `'(add 2 3)'`.\r\n\r\n* For add and mult expressions, evaluate each token and return the addition or multiplication of them.\r\n\r\n* For let expressions, evaluate each expression sequentially and assign it to the variable in the current scope, then return the evaluation of the final expression."
],