摘要:
【0347.前K个高频元素】 class Solution { public: vector<int> topKFrequent(vector<int>& nums, int k) { unordered_map <int, int> map; for (int i = 0; i < nums.si 阅读全文
摘要:
【0150.逆波兰表达式求值】 class Solution { public: int evalRPN(vector<string>& tokens) { stack<long long> st1; long long temp1; long long temp2; for (int i = 0; 阅读全文
摘要:
【0027.移除元素】 class Solution { public: int removeElement(vector<int>& nums, int val) { int fast = 0; int slow = 0; for (int fast = 0; fast < nums.size() 阅读全文
摘要:
【0459.重复的子字符串】 class Solution { public: bool repeatedSubstringPattern(string s) { for (int i = 0; i < s.size()/2; i++) { int k = i + 1; for (int j = 0 阅读全文
摘要:
【0151.翻转字符串里的单词】 class Solution { public: string reverseWords(string s) { int slow = 0; int fast = 1; while (fast < s.size()) { if (s[slow] == ' ' && 阅读全文