• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
村雨sup
自己选的路,跪着也要走完 XD
博客园    首页    新随笔    联系   管理    订阅  订阅
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)
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3