llllmz

导航

2024年9月19日

146. LRU 缓存

摘要: \ class LRUCache { public: LRUCache(int capacity) :_capacity(capacity) {} int get(int key) { auto it = _unorderedMap.find(key); if(it != _unorderedMap 阅读全文

posted @ 2024-09-19 17:31 神奇的萝卜丝 阅读(22) 评论(0) 推荐(0)

20. 有效的括号

摘要: 学习了C++ stack的使用 class Solution { public: #include<stack> bool isValid(string s) { stack<char> stk; for(int i = 0; i < s.size(); ++i){ if(s[i] == '(' | 阅读全文

posted @ 2024-09-19 11:16 神奇的萝卜丝 阅读(18) 评论(0) 推荐(0)