2022年1月11日

摘要: https://www.cnblogs.com/kyoner/p/11080078.html https://leetcode-cn.com/problems/search-insert-position/solution/te-bie-hao-yong-de-er-fen-cha-fa-fa-mo 阅读全文
posted @ 2022-01-11 15:33 行者常至,为者长成 阅读(101) 评论(0) 推荐(0) 编辑

2021年4月10日

摘要: 一、使用stringstream 类c++中的 <sstream>库定义了三种类:istringstream、ostringstream和stringstream,分别用来进行流的输入、输出和输入输出操作。 二、c++中 stoi将 n 进制的字符串转化为十进制示例:stoi(str, 0, 2); 阅读全文
posted @ 2021-04-10 17:38 行者常至,为者长成 阅读(323) 评论(0) 推荐(0) 编辑
 
摘要: priority_queue的用法 https://blog.csdn.net/xiaoquantouer/article/details/52015928 https://blog.csdn.net/weixin_36888577/article/details/79937886 #include 阅读全文
posted @ 2021-04-10 17:32 行者常至,为者长成 阅读(41) 评论(0) 推荐(0) 编辑

2021年3月5日

摘要: 智能指针的行为类似常规指针,重要的区别是它负责自动释放所指的对象。C++11标准库提供的这两种智能指针的区别在于管理底层指针的方式:shared_ptr允许多个指针指向同一个对象;unique_ptr则"独占"所指向的对象。 C++11提供了三种智能指针:std::shared_ptr, std:: 阅读全文
posted @ 2021-03-05 16:02 行者常至,为者长成 阅读(362) 评论(0) 推荐(0) 编辑

2020年6月19日

摘要: 1、盛水最多的容器 2、三数之和 3、四数之和 阅读全文
posted @ 2020-06-19 15:28 行者常至,为者长成 阅读(164) 评论(0) 推荐(0) 编辑

2020年6月5日

摘要: 1、交换字符串中的元素: https://leetcode-cn.com/problems/smallest-string-with-swaps/solution/bing-cha-ji-by-liyiping/ 并查集详解见博客:https://blog.csdn.net/qq_41593380/ 阅读全文
posted @ 2020-06-05 00:11 行者常至,为者长成 阅读(45) 评论(0) 推荐(0) 编辑

2020年3月30日

摘要: 一、sort函数 在sort函数中使用 greater<>() 和 less<int>()int A[]={1,4,3,7,10};const int N=sizeof(A)/sizeof(int);vector<int>vec(A, A+N); sort(vec.begin(),vec.end() 阅读全文
posted @ 2020-03-30 21:27 行者常至,为者长成 阅读(540) 评论(0) 推荐(0) 编辑

2020年3月29日

摘要: 1、find使用 不同于map(map有find方法),vector本身是没有find这一方法,其find是依靠algorithm来实现的。 #include <iostream>#include <algorithm>#include <vector> int main(){ using name 阅读全文
posted @ 2020-03-29 11:44 行者常至,为者长成 阅读(395) 评论(0) 推荐(0) 编辑

2020年3月22日

摘要: 1、常见贪心算法题目 中等:55. 跳跃游戏https://leetcode-cn.com/problems/jump-game/134. 加油站https://leetcode-cn.com/problems/gas-station/ 困难:45. 跳跃游戏 IIhttps://leetcode- 阅读全文
posted @ 2020-03-22 11:44 行者常至,为者长成 阅读(128) 评论(0) 推荐(0) 编辑
 
摘要: 1、若题目中明确说明只包含字母,可以考虑哈希表 LeetCode常见题型: 1、字符串的排列https://leetcode-cn.com/problems/permutation-in-string/ 2、 拼写单词https://leetcode-cn.com/problems/find-wor 阅读全文
posted @ 2020-03-22 11:42 行者常至,为者长成 阅读(79) 评论(0) 推荐(0) 编辑