01 2021 档案
字节跳动2019
摘要:[编程题]万万没想到之聪明的编辑 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32M,其他语言64M 我叫王大锤,是一家出版社的编辑。我负责校对投稿来的英文稿件,这份工作非常烦人,因为每天都要去修正无数的拼写错误。但是,优秀的人总能在平凡的工作中发现真理。我发现一个发现拼写错误的
阅读全文
华为机试 迷宫问题dfs
摘要:#include<iostream> #include "bits/stdc++.h" using namespace std; int N,M; int MAP[11][11]; void dfs(int i,int j,vector<int>veci,vector<int>vecj){ if(i
阅读全文
华为机试 字符串加解密
摘要:#include<iostream> #include <vector> #include "bits/stdc++.h" using namespace std; char jiami(char s){ if(s >= 'a'&&s < 'z'){return char(s-31);} else
阅读全文
华为机试 单词倒排
摘要:#include<iostream> #include <vector> #include "bits/stdc++.h" using namespace std; int main() { string s; getline(cin,s); vector<string> vecstr; strin
阅读全文
华为机试-字符串分割
摘要:#include<iostream> #include <vector> #include "bits/stdc++.h" using namespace std; int main() { string s; while(cin >> s){ int lens = s.size(); while(
阅读全文
16位转10位写法
摘要:题目描述 写出一个程序,接受一个十六进制的数,输出该数值的十进制表示。(多组同时输入 ) 输入描述: 输入一个十六进制的数值字符串。 输出描述: 输出该数值的十进制字符串。 1 2 3 4 5 6 7 8 #include <stdio.h> int main() { int num = 0; wh
阅读全文
Leetcode 394. 字符串解码
摘要:class Solution { public: string decodeString(string s) { int num = 0; string stradd = ""; stack<string> strstack; stack<int> intstack; for(int i=0;i <
阅读全文
Leetcode 200. 岛屿数量
摘要:class Solution { public: int numIslands(vector<vector<char>>& grid) { int nr = grid.size(); if(nr == 0) return 0; int nc = grid[0].size(); int ans = 0
阅读全文
Leetcode 3. 无重复字符的最长子串
摘要:class Solution { public: int lengthOfLongestSubstring(string s) { int maxlen = 0; for(int i=0;i < s.size();i++){ unordered_map<char,int> mp; mp[s[i]]
阅读全文
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; } };
阅读全文
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)?
阅读全文
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
阅读全文
Leetcode 1160. 拼写单词
摘要:class Solution { public: int countCharacters(vector<string>& words, string chars) { unordered_map<char,int>mpchar; for(char c:chars){ mpchar[c]++; } i
阅读全文
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);
阅读全文
Leetcode 1429. 第一个唯一数字
摘要:class FirstUnique { public: FirstUnique(vector<int>& nums) { for(auto num:nums){ q.push(num); mp[num]++; } } int showFirstUnique() { while(!q.empty()&
阅读全文
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;
阅读全文
浙公网安备 33010602011771号