摘要: # Markdown学习 # 标题 ## 二级标题 ### 三级标题 ## 字体 hello world hello world hello world hello world ## 引用 > 好好学习,天天向上 ## 分割线 ******** ## 图片 ## 超链接 百度 ## 列表 1. A 阅读全文
posted @ 2022-02-09 15:43 cumtljz 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 题面: 题解:单调栈 代码: class Solution { public: string removeDuplicateLetters(string s) { int n = s.size(); vector<int> num(26,0),vis(26,0); string stk; for(i 阅读全文
posted @ 2022-01-26 19:30 cumtljz 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 题面: 题解:前缀10字典序比2小,因此这个类似于类似于求前缀和。函数getnum(pre,n)求前缀pre为根结点的前缀和的数量。pre=1开始,如果当前节点的子节点数量大于k则pre*=10,否则 pre++。 代码: class Solution { public: int getnum(lo 阅读全文
posted @ 2022-01-25 22:23 cumtljz 阅读(27) 评论(0) 推荐(0) 编辑
摘要: 题面: 题解:按照拓扑序即可。 代码: class Solution { public: string alienOrder(vector<string>& words) { int n = words.size(); string ans=""; unordered_map<char, unord 阅读全文
posted @ 2022-01-23 15:58 cumtljz 阅读(34) 评论(0) 推荐(0) 编辑
摘要: 题面: 题解: 双指针找区间即可。 代码: class Solution { public: int numberOfSubstrings(string s) { int numa = 0,numb = 0,numc = 0,l = 0,r = 0; int n = s.size(); int an 阅读全文
posted @ 2022-01-22 22:13 cumtljz 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 题面: 题解:bfs即可,不过要注意判重,相同值的加入一次即可。 代码: class Solution { public: int minJumps(vector<int>& arr) { map< int, vector<int> >ma; queue<pair<int, int> >q; int 阅读全文
posted @ 2022-01-21 17:22 cumtljz 阅读(24) 评论(0) 推荐(0) 编辑
摘要: 题面: 题解:维护长度为p的长度的滑动窗口,cnts维护当前窗口内个字母s与p的差,用一个变量res维护不同的数量,当res=0时是异位词。 class Solution { public: int cnts[26]; int cntp[26]; vector<int> findAnagrams(s 阅读全文
posted @ 2022-01-20 20:12 cumtljz 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 题面: 样例: 题解:暴力搜索,加上相等剪枝。 代码: class Solution { public: int n,m; int k; int dx[4]={-1,1,0,0}; int dy[4]={0,0,-1,1}; int vis[205][205]; vector<vector<char 阅读全文
posted @ 2022-01-19 19:32 cumtljz 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 题面: 题解:从小到大排序,取相邻的最小差即可。 代码: class Solution { public: int findMinDifference(vector<string>& t) { vector<int>res; int n=t.size(); if(n>1440)return 0; f 阅读全文
posted @ 2022-01-18 00:42 cumtljz 阅读(28) 评论(0) 推荐(0) 编辑
摘要: array即数组是numpy中的核心对象,python中的list可以实现与array相同的功能,但与list不同的是array的所有元素必须是同一个数据类型,因此array比list性能好,包含数组元数据信息和大量的便捷函数。 array本身的属性: shape:返回一个元组,表示array的维度 阅读全文
posted @ 2022-01-17 16:11 cumtljz 阅读(22) 评论(0) 推荐(0) 编辑