• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
村雨sup
自己选的路,跪着也要走完 XD
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 2 3 4 5 6 7 8 ··· 42 下一页
2021年1月8日
Leetcode 剑指 Offer 62. 圆圈中最后剩下的数字
摘要: class Solution { public: int lastRemaining(int n, int m) { int f = 0; for (int i = 2; i != n + 1; ++i) { f = (m + f) % i; } return f; } }; 阅读全文
posted @ 2021-01-08 16:52 村雨sup 阅读(59) 评论(0) 推荐(0)
Leetcode 476. 数字的补数
摘要: class Solution { public: int findComplement(int num) { int sum = 0; long long x = 1; while(num){ int shang = num/2; int yu = num%2; int y = (yu == 1)? 阅读全文
posted @ 2021-01-08 16:09 村雨sup 阅读(52) 评论(0) 推荐(0)
Leetcode 821. 字符的最短距离
摘要: class Solution { public: vector<int> shortestToChar(string S, char C) { vector<int>vc(S.size(),10001); for(int i=0;i < S.size();i++){ if(S[i] == C){ v 阅读全文
posted @ 2021-01-08 15:39 村雨sup 阅读(78) 评论(0) 推荐(0)
Leetcode 1160. 拼写单词
摘要: class Solution { public: int countCharacters(vector<string>& words, string chars) { unordered_map<char,int>mpchar; for(char c:chars){ mpchar[c]++; } i 阅读全文
posted @ 2021-01-08 11:38 村雨sup 阅读(62) 评论(0) 推荐(0)
Leetcode 997. 找到小镇的法官
摘要: class Solution { public: int findJudge(int N, vector<vector<int>>& trust) { vector<unordered_set<int>> vc1(N+1); vector<unordered_set<int>> vc2(N+1); 阅读全文
posted @ 2021-01-08 11:08 村雨sup 阅读(82) 评论(0) 推荐(0)
2021年1月7日
Leetcode 1429. 第一个唯一数字
摘要: class FirstUnique { public: FirstUnique(vector<int>& nums) { for(auto num:nums){ q.push(num); mp[num]++; } } int showFirstUnique() { while(!q.empty()& 阅读全文
posted @ 2021-01-07 17:22 村雨sup 阅读(154) 评论(0) 推荐(0)
Leetcode 554. 砖墙
摘要: class Solution { public: int leastBricks(vector<vector<int>>& wall) { unordered_map<int,int> mp;//统计缝的重复数量 for(int i=0;i<wall.size();++i){ int len=0; 阅读全文
posted @ 2021-01-07 14:08 村雨sup 阅读(78) 评论(0) 推荐(0)
2020年12月30日
C++ 复习
摘要: int main() { int a = 1; int b = a++; cout << a << b << endl; return 0; } 输出2 1 #include<iostream> using namespace std; int main() { int a = 1; int b = 阅读全文
posted @ 2020-12-30 10:19 村雨sup 阅读(110) 评论(0) 推荐(0)
2019年9月4日
PAT 1051 Pop Sequence (25 分)
摘要: 返回 1051 Pop Sequence (25 分) 返回 1051 Pop Sequence (25 分) 1051 Pop Sequence (25 分) Given a stack which can keep M numbers at most. Push N numbers in the 阅读全文
posted @ 2019-09-04 18:47 村雨sup 阅读(233) 评论(0) 推荐(0)
2019年9月3日
PAT 1036 Boys vs Girls (25 分)
摘要: 1036 Boys vs Girls (25 分) 1036 Boys vs Girls (25 分) 1036 Boys vs Girls (25 分) This time you are asked to tell the difference between the lowest grade 阅读全文
posted @ 2019-09-03 21:19 村雨sup 阅读(201) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 ··· 42 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3