06 2022 档案
摘要:System.out cannot be resolved to a type 将jdk版本改到8可以运行
阅读全文
摘要:unordered_map的遍历: 参见https://blog.csdn.net/qq_21539375/article/details/122003559 推荐: for(auto kv:map){ cout<<kv.first<<kv.second<<endl; }
阅读全文
摘要:System.out.println(String.format("%.2f",money));
阅读全文
摘要:线程通信 #include <semaphore.h> class Foo { protected: sem_t firstJobDone; sem_t secondJobDone; public: Foo() { sem_init(&firstJobDone, 0, 0); sem_init(&s
阅读全文
摘要:vector的插入: vector<int>v; v.insert(v.begin(),val);
阅读全文
摘要:用子字符串是过不了的,超时,需要一个一个字符判断 class Solution { public: string removeDuplicates(string s) { int n = s.size(),top = 0; if(n==1)return s; for(int i=0;i<n;i++)
阅读全文
摘要:参考https://blog.csdn.net/qq_33726635/article/details/106649623 C++的substr第二个参数表示长度 java的substr的第二个参数表示end下标
阅读全文
摘要:用优先队列存储前k大元素,堆顶是第k大元素,每一次添加一个元素道优先队列,如果队列长度大于k就pop堆顶元素 参考https://blog.csdn.net/qq_41687938/article/details/117827166 class KthLargest { public: priori
阅读全文