摘要:
leetcode1544 字符串删除操作: string s = ”12345“; s.erase(m,n); 删除s中从m下标开始的n个字符 leetode1560 int data[n]; //分配栈内存 int*data = new int[n]; //分配堆内存并用栈内存data指向该内存区 阅读全文
摘要:
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 阅读全文
摘要:
计算两个日期的间隔是否是一天 datediff(w1.recordDate,w2.recordDate)=1 {"headers": ["id"], "values": [[678], [446], [517], [955], [1007], [329], [603], [798], [812], 阅读全文