摘要: 思路: 当字符串为运算符号是弹出栈中两个数字进行运算 stoi("1") 将string转换为int class Solution { public: int evalRPN(vector<string>& tokens) { stack<int> stack; for (int i = 0; i 阅读全文
posted @ 2022-08-27 09:59 hjy94wo 阅读(21) 评论(0) 推荐(0)
摘要: class Solution { public: string removeDuplicates(string s) { stack<char> stack; for (int i = 0; i < s.size(); i ++) { if (stack.empty() || s[i] != sta 阅读全文
posted @ 2022-08-27 09:18 hjy94wo 阅读(19) 评论(0) 推荐(0)
摘要: class Solution { public: bool isValid(string s) { stack<char> stack; for (int i = 0; i < s.size(); i ++) { if (s[i] == ')' || s[i] =='}' || s[i] == '] 阅读全文
posted @ 2022-08-27 09:10 hjy94wo 阅读(17) 评论(0) 推荐(0)