2020年6月19日

摘要: 1、盛水最多的容器 2、三数之和 3、四数之和 阅读全文
posted @ 2020-06-19 15:28 行者常至,为者长成 阅读(173) 评论(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 行者常至,为者长成 阅读(67) 评论(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 行者常至,为者长成 阅读(695) 评论(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 行者常至,为者长成 阅读(421) 评论(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 行者常至,为者长成 阅读(135) 评论(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 行者常至,为者长成 阅读(84) 评论(0) 推荐(0)
 
摘要: 1、输入输出#include<iostream>using namespace std;int n;cin>>n;cout<< n<<endl; 字符串注意:cin提取始终将空格(空格,制表符,换行符...)视为终止要提取的值,因此提取字符串意味着始终提取单个单词,而不是短语或整个句子。cin>>s 阅读全文
posted @ 2020-03-22 11:40 行者常至,为者长成 阅读(220) 评论(0) 推荐(0)

2020年3月20日

摘要: 动态规划三部曲 1)定义数组元素含义 2)寻找递推关系 dp 3)找初始值 参考博客:https://zhuanlan.zhihu.com/p/91582909 解题步骤: 1、确定需要保存在dp表中的状态。(关键:确定影响状态的维度和每个元素代表的含义) 一维:dp[n]=f(dp[n-1]) 二 阅读全文
posted @ 2020-03-20 21:49 行者常至,为者长成 阅读(142) 评论(0) 推荐(0)
 
摘要: 参考博客: https://blog.csdn.net/niyaozuozuihao/article/details/91802994 1、运行命令run:简记为 r ,其作用是运行程序,当遇到断点后,程序会在断点处停止运行,等待用户输入下一步的命令。continue (简写c ):继续执行,到下一 阅读全文
posted @ 2020-03-20 21:48 行者常至,为者长成 阅读(769) 评论(0) 推荐(0)
 
摘要: 554. 砖墙https://leetcode-cn.com/problems/brick-wall/939. 最小面积矩形https://leetcode-cn.com/problems/minimum-area-rectangle/ 73. 矩阵置零https://leetcode-cn.com 阅读全文
posted @ 2020-03-20 21:46 行者常至,为者长成 阅读(107) 评论(0) 推荐(0)