首页
题库
公司真题
专项练习
面试题库
在线编程
面试
面试经验
AI 模拟面试
简历
求职
学习
基础学习课
实战项目课
求职辅导课
专栏&文章
竞赛
我要招人
发布职位
发布职位、邀约牛人
更多企业解决方案
AI面试、笔试、校招、雇品
HR免费试用AI面试
最新面试提效必备
登录
/
注册
听海时节
2017-09-20 21:07
香港科技大学 Java
关注
已关注
取消关注
华为第三道题目
第三题怎么改都只有37.5,有大佬100AC的吗,要求的输出顺序到底是什么呀?大雾
提示
全部评论
推荐
最新
楼层
SUPERKCH
中山大学 C++
75% +1. 检查半天看不出漏了哪种情况,题名还特意说明 没有非法输入。 最逗的是题目要求按升序,而例子是降序。
点赞
回复
分享
发布于 2017-09-20 21:22
Jenson
上海交通大学 Java
#include <iostream> #include <cstring> #include <string> #include <cstdlib> #include <cstdio> #include <vector> #include <stack> #include <algorithm> #include <set> #include <queue> #include <cctype> #include <cmath> #include <map> #include <unordered_map> #include <deque> #include <sstream> using namespace std; void replace(string str, const string &bitset, unordered_map<int, int> &record, char nc){ bool flag = false; int idx = 1; int i = bitset.size() - 1; while(i >= 0) { if(bitset[i] == '1') { int strIdx = record[idx]; str[strIdx] = nc; flag = true; } --i; ++idx; } if(flag) { cout << ',' << str; } } bool nextBitSet(string &bitset) { const int len = bitset.size(); if(bitset[len-1] == '0') { bitset[len-1] = '1'; return true; } int curIdx = len-1; while(curIdx >= 0) { if(bitset[curIdx] == '0') { bitset[curIdx] = '1'; break; } bitset[curIdx--] = '0'; } if(curIdx < 0) return false; return true; } int main() { string str; char oc, nc; cin >> str >> oc >> nc; oc = tolower(oc); unordered_map<int, int> record; const int len = str.size(); int idx = 1; int maxIdx = -1; bool found = false; for(int i = len-1; i >= 0; --i) { char ch = tolower(str[i]); if(ch == oc) { found = true; record[idx++] = i; maxIdx = (idx > maxIdx? idx : maxIdx); } } if(found) { string bitset(maxIdx-1, '0'); cout << str; while(nextBitSet(bitset)) { replace(str, bitset, record, nc); } cout << endl; }else{ cout << str << endl; } return 0; } 100%通过
点赞
回复
分享
发布于 2017-09-20 21:19
每天学一点
杭州电子科技大学 Java
public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); String str = s.nextLine(); String[] strings = str.split(" "); TreeSet<String> ts = new TreeSet<String>(new Comparator<String>(){ @Override public int compare(String o1, String o2) { return o2.compareTo(o1); } }); ts.add(strings[0]); new Test3().swap(ts,strings[0],strings[1],strings[2]); String last = ts.pollLast(); for (String string : ts) { System.out.print(string+","); } System.out.println(last); s.close(); } public TreeSet<String> swap(TreeSet<String> ts,String str1,String str2,String str3){ for (int i = 0; i < str1.length(); i++) { if(str2.equals(str1.charAt(i)+"")){ StringBuilder sb = new StringBuilder(str1); String string = sb.replace(i, i+1, str3).toString(); ts.add(string); swap(ts,string,str2,str3); } } return ts; } } 不知道对错啊,大神帮看一看
点赞
回复
分享
发布于 2017-09-20 21:18
Superninesun
杭州电子科技大学 C++
// 华为第三题.cpp : 定义控制台应用程序的入口点。// include "stdafx.h" include <iostream> include <string> include <vector> using namespace std; int main(){ string input; string src; string dest; cin >> input>>src>>dest; string mytemp; int num = 0; for (int i = 0; i < input.size(); i++) { if (input[i] == src[0]) { num++; mytemp.push_back('0'); } } string stard; for (int i = 0; i < num; i++) { stard.push_back('1'); } vector<string> res; for (int i = 0; i < pow(2, num); i++) { string restemp = input; int cnt = 0; for (int j = 0; j < input.size(); j++) { if (restemp[j] == src[0]) { if (src[0] > dest[0]) { if (mytemp[cnt] == '1') { restemp[j] = dest[0]; } } else { if (mytemp[cnt] == '0') { restemp[j] = dest[0]; } } cnt++; } } res.push_back(restemp); int k = 1; int jinwei = 1; while (jinwei == 1 && mytemp!=stard) { if (mytemp[num - k] == '0') { mytemp[num - k] = '1'; k++; jinwei = 0; } else if (mytemp[num - k] == '1') { mytemp[num - k] = '0'; jinwei = 1; k++; } } } for (int i = 0; i < res.size()-1; i++) { cout << res[i] <<','; } cout << res[res.size() - 1] << endl; cin.get(); cin.get(); return 0; }
点赞
回复
分享
发布于 2017-09-20 21:13
Kay_sysu2017
腾讯_云产品部_前端工程师
75%的路过。
点赞
回复
分享
发布于 2017-09-20 21:11
L.W.M
同济大学 算法工程师
没用一题100AC 也是服了
点赞
回复
分享
发布于 2017-09-20 21:11
小亮邱
浙江大学 Java
百分之75路过。。
点赞
回复
分享
发布于 2017-09-20 21:09
暂无评论,快来抢首评~
相关推荐
07-15 12:06
门头沟学院 前端工程师
大疆80分钟的测评?
有老哥知道大疆这个是性格测评+笔试题吗怎么一下子80min啊听说还有很多行测...
投递大疆等公司7个岗位
点赞
评论
收藏
分享
07-14 13:42
门头沟学院 Java
是提前批的门槛太高了吗?
为什么我投提前批都是流程终止这样秋招真的能找到工作吗...
点赞
评论
收藏
分享
07-01 16:05
河南师范大学 Java
唉,好累啊
双非大二快大三了。八股文还没开始背,我是写项目玩呢还是背着八股开始投着试试呢?暑假事也很多🖐🏻😭🖐🏻,勾八简历也是一坨,其实写的技术栈我只会在ai的帮助下会用和能看懂罢了
南宫生:
先背八股
点赞
评论
收藏
分享
06-03 20:53
门头沟学院 Java
瑞**啡,不用面试,直接入职!
hr加我好友,直接通知我入职😳😳😳一脸懵,我没面过试啊,我都不记得投了这个。以为是招聘服务员的。回家一查,发现投过他家的厦门Java,投递日期已经过去了一个月,还是“简历筛选中”😰😰原来是同名的入职了,估计是筛选条件弄错了😪😭世界是一个巨大的草台班子难过,名字都一样,为什么不过我(怒吼)
梦想去阿里的冰棍:
《没准过两年就有面试了》,扎心了老铁
点赞
评论
收藏
分享
07-14 15:00
深圳大学 C++
华为OD-C++开发岗
华为 od 面经 1.本人情况:目标非科班,无相关实习经历; 2.找到德科hr姐姐后,会跟你确认简历和一些相关信息,然后会发机考链接; 3.机考通过后有个性格测试,hr姐姐会给一些大致方向性的叮嘱; 4.大约一周后资格面,主要了解一下候选人背景,地域稳定性之类的,聊聊天 不涉及技术问题,正常回答即可,面之前hr姐姐会叮嘱一些注意事项; 5.技术面试有两次,一般都是项目开头,中间八股,手撕结尾,保持谦虚冷静,认真面即可; 6.主管面比较轻松,也是聊聊天; 全部通过后坐等offer,全部流程不超过一个月,hr姐姐非常给力,全程跟进,有问必答,最后还会帮忙跟公司拉扯薪资,非常负强烈推荐!
华OD面经
点赞
评论
收藏
分享
评论
点赞成功,聊一聊 >
点赞
收藏
分享
评论
提到的真题
返回内容
全站热榜
更多
1
...
我和妈妈讲以后我可能给不了她一个月1500
5797
2
...
滴滴提前批一面秒挂面经
5632
3
...
滴滴提前批一面
5179
4
...
后端实习到底该干什么啊
4955
5
...
王侯将相宁有种乎!
4332
6
...
双非本应届是如何拿到30
3851
7
...
卷王的风气还是吹到了实习
3693
8
...
实习,别太较真
3605
9
...
腾讯提前批后台开发凉经teg
2954
10
...
给公司上一课
2907
创作者周榜
更多
正在热议
更多
#
如何提高实习转正率?
#
11589次浏览
160人参与
#
打工人的工作餐日常
#
51306次浏览
400人参与
#
哪些公司真双非友好?
#
14938次浏览
81人参与
#
追觅科技求职进展汇总
#
17670次浏览
120人参与
#
你觉得技术面多长时间合理?
#
98630次浏览
714人参与
#
26届的你们有几段实习?
#
38575次浏览
445人参与
#
月薪多少能在一线城市生存
#
21281次浏览
268人参与
#
双非能在秋招上岸吗?
#
220709次浏览
1168人参与
#
你后悔自己读研吗?
#
16499次浏览
229人参与
#
非技术2023笔面经
#
248310次浏览
2412人参与
#
你以为的实习VS真实的实习
#
23474次浏览
218人参与
#
当下环境,你会继续卷互联网,还是看其他行业机会
#
116985次浏览
808人参与
#
你认为哪些项目算烂大街?
#
15582次浏览
261人参与
#
机械校招之路总结
#
93426次浏览
1893人参与
#
学历贬值真的很严重吗?
#
23194次浏览
165人参与
#
你被哪些公司秒挂过?
#
28865次浏览
236人参与
#
产品实习,你更倾向大公司or小公司
#
159281次浏览
1964人参与
#
网申一定要掌握的小技巧
#
10590次浏览
66人参与
#
找工作时的取与舍
#
82508次浏览
589人参与
#
最难的技术面是哪家公司?
#
8677次浏览
70人参与
牛客网
牛客网在线编程
牛客网题解
牛客企业服务