leetcode:逆波兰表达式求值
分析
典型stack
ac code
class Solution {
public:
int evalRPN(vector
// 考虑stack
stack
// for each
for(auto token: tokens) {
if(token == "+" || token == "-" || token == "*" || token == "/") {
int b = s.top();
s.pop();
int a = s.top();
s.pop();
int c;
共有 0 条评论