C++
Stone克鲁斯
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
linux常见问题
cannot open shared object file: No such file or directory 编译过程中,./config的时候如果不指定--prefix;默认动态链接库安装在/usr/local/lib下,(包含目录在/usr/local/include下)。当运行程序需要链接动态库时,提示找不到相关的.so库。因为/usr/local/lib目录不在系统默认的库搜索目录中,所以需要将目录加进去。 cd /etc sudo vi ld.so.conf 在下: includ原创 2020-11-16 19:50:15 · 441 阅读 · 0 评论 -
Leetcode (Two Sum)
给定一个整数数组和一个目标值,找出数组中和为目标值的两个数。 你可以假设每个输入只对应一种答案,且同样的元素不能被重复利用。 给定 nums = [2, 7, 11, 15], target = 9 因为 nums[0] + nums[1] = 2 + 7 = 9 所以返回 [0, 1] class Solution { public: vector<int> two...原创 2018-10-03 11:05:03 · 401 阅读 · 0 评论 -
大数问题
大数相加 #include <algorithm> //reverse #include <string> //string class Solution { public: string addStrings(string num1, string num2) { int length1=num1.size(); i...原创 2019-08-04 17:03:18 · 298 阅读 · 0 评论 -
单例
加锁懒汉式 懒汉:在第一次用到类实例的时候才会去实例化。 在访问量较小时,采用懒汉实现。这是以时间换空间。(注意,懒汉本身是线程不安全的) #include <iostream> #include<mutex> #include<thread> using namespace std; std::mutex mtx; class CSingleton ...原创 2019-07-31 21:25:24 · 246 阅读 · 0 评论 -
买卖股票
#include<iostream> #include<vector> #include<algorithm> using namespace std; int maxProfit(vector<int>& prices) { int res = 0; int len = prices.size(); vector<v...原创 2019-08-10 16:32:07 · 433 阅读 · 0 评论
分享