上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 20 下一页
摘要: class Solution { public: int getMaxValue(vector<vector<int>>& grid) { int n=grid.size(),m=grid[0].size(); vector<vector<int>> f(n,vector<int> (m,0));/ 阅读全文
posted @ 2023-04-24 14:50 穿过雾的阴霾 阅读(18) 评论(0) 推荐(0)
摘要: class Solution { public: static bool cmp(int a,int b) { string as=to_string(a),bs=to_string(b); return as+bs<bs+as; } string printMinNumber(vector<int 阅读全文
posted @ 2023-04-23 15:46 穿过雾的阴霾 阅读(13) 评论(0) 推荐(0)
摘要: class Solution { public: int digitAtIndex(int n) { if(!n) return 0; long long start=1,len=1,cnt=1;//记录区间的起始位置,记录区间长度,cnt记录当前是几位数 //往后走,跨度为一个区间 while(1 阅读全文
posted @ 2023-04-21 14:57 穿过雾的阴霾 阅读(15) 评论(0) 推荐(0)
摘要: class Solution { public: int numberOf1Between1AndN_Solution(int n) { vector<int> q; do { q.push_back(n%10); n/=10; }while(n); int res=0; for (int i = 阅读全文
posted @ 2023-04-20 11:12 穿过雾的阴霾 阅读(18) 评论(0) 推荐(0)
摘要: class Solution { public: int maxSubArray(vector<int>& nums) { int n=nums.size(),res=-0x3f3f3f3f; for (int i = 0; i < n;)//枚举以i为起点的区间 { int j=i,sum=0; 阅读全文
posted @ 2023-04-19 16:50 穿过雾的阴霾 阅读(14) 评论(0) 推荐(0)
摘要: class Solution { public: priority_queue<int> max_heap; priority_queue<int,vector<int>,greater<int>> min_heap; void insert(int num){ max_heap.push(num) 阅读全文
posted @ 2023-04-19 16:13 穿过雾的阴霾 阅读(17) 评论(0) 推荐(0)
摘要: class Solution { public: bool f[310]; bool wordBreak(string s, vector<string>& wordDict) { unordered_set<string> hashtable; for(auto i:wordDict) hasht 阅读全文
posted @ 2023-04-18 16:11 穿过雾的阴霾 阅读(23) 评论(0) 推荐(0)
摘要: class Solution { public: bool check(string s) { int n=s.size(); for(int i=0;i<n/2;i++) if(s[i]!=s[n-i-1]) return false; return true; } vector<vector<s 阅读全文
posted @ 2023-04-16 11:18 穿过雾的阴霾 阅读(11) 评论(0) 推荐(0)
摘要: class Solution { public: vector<vector<int>> res; vector<int> path; bool st[10]; void dfs(vector<int>& nums,int u) { int n=nums.size(); if(u==n) { res 阅读全文
posted @ 2023-04-15 20:31 穿过雾的阴霾 阅读(29) 评论(0) 推荐(0)
摘要: class Solution { public: int moreThanHalfNum_Solution(vector<int>& nums) { int cnt=0,val=-1;//val给一个无效值即可 for(auto x:nums) { if(!cnt)//投票最多人没了,接下来任何人都 阅读全文
posted @ 2023-04-15 20:31 穿过雾的阴霾 阅读(20) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 20 下一页