![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
力扣
chen_512
这个作者很懒,什么都没留下…
展开
-
逆波兰表达式
//逆波兰表达式class Solution{public: int evalRPN(vector<string>& tokens) { stack<int> mystack;//tokens只包含了int和四个表达式则可以用int if (tokens.empty()) return 0; for (string s : tokens) {原创 2022-04-05 09:54:51 · 270 阅读 · 0 评论 -
括号匹配-
//数组存储class Solution {public: bool isValid(string s) { if (s.empty()) return true; char s1[10001]; int top = -1; for (char c : s) { if (c == '(' || c == '[' || c == '{') { s1[++t原创 2022-04-04 10:46:41 · 240 阅读 · 0 评论 -
两数相加--递归法
/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */struct ListNode* addTwoNumbers_2(struct ListNode* l1, struct ListNode* l2){ if (l2 == NULL&&l1->val==-1) return l2;原创 2022-03-26 23:48:49 · 416 阅读 · 0 评论 -
合并两个有序链表
/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; *///递归法struct ListNode* mergeTwoLists(struct ListNode* list1, struct ListNode* list2){ if(NULL==list1&&NULL==list2) return NU原创 2022-03-25 23:30:38 · 68 阅读 · 0 评论