华为机试书签

note1. again!
ctrl + F + again! to find the problems that need a double check

hj7. casting
float i;
int j = (int) i;

hj9. unordered_set
unordered_set
reverse(str.begin(), str.end())
set.count©
set.insert©

hj46. sub string
string s;
s.substr(0, 3); // 3 is not included

hj58. sort vector
vector v;
sort(v.begin(), v.end());

hj2. getline
string array;
getline(cin, array); // this gets more than cin

hj5. ASCII
‘0’ is ASCII 48
‘A’ is ASCII 65
if (s[i] >= ‘0’ && s[i] <= ‘9’)
ans += base * ((int)(s[i]-55));

hj6. prime factor
again!

hj8. map
map<int, int> m;
map<int, int>::iterator it;
it = m.find(a);
m[a] = it->second + b;
it=m.begin(); it!=m.end();it++

hj15. bitset and binary
bitset<32> b(5);
int ans = b.count(); // number of bits that are set
// in this case ans = 2

hj21. password and string.find()
// don’t ever try to to_string(char) because it turns it into its ASCII value
// check https://www.geeksforgeeks.org/string-find-in-cpp/

hj22. a strange question
again!

hj23. a very good practice question
again!

hj31. how to reverse words in a string?
again!

hj35. sequence
2阶差的一半是n方的系数

hj37. fibonacci and breeding problem
again!

hj54. calculator
this is the hardest simple question, by far
again!

hj61. dynamic programming
again!

hj85. interesting question about 回文

hj86. bitset和更新最大值

hj94. nasty question, map and insertion order
needs a vector!

hj97. printf

hj102. research on this strange way to sort with a bool
again!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值