Leetcode: Day 130, #282 #286 Expression Add Operators, Walls and Gates
Day 130, #282 #286 Expression Add Operators, Walls and Gates Expression Add Operators 0-9 + , - between the digits so they evaluate to the target value. Examples: --------------------------------------------------------------------------- 如果遇到"*",则返回之前的操作(因为之前的运算符和值都已经存好) 1 + 2 * 3,之前 1 + 2已经算出为3,之前的运算符为+,值为2。然后此时 总值- 2 + 2 * 3 cur为当前的总值,op为之前运算符,val为上一步计算的值 class Solution { public: int target; void dfs(vectorRead full article from Leetcode: Day 130, #282 #286 Expression Add Operators, Walls and Gates
No comments:
Post a Comment