Sunday, July 3, 2016

AorB - HackerRank - C++ code study

July 3, 2016

Study C++ code submission on HackerRank - AorB:

1.
https://gist.github.com/jianminchen/4a608ffd202433f9be264c392f1bd75a

2
https://gist.github.com/jianminchen/d8879283c292454e2638444328633f09

3.
https://gist.github.com/jianminchen/d65f78caec4c8953949639b70dbdf192

4.
https://gist.github.com/jianminchen/9e72d35b50dc570a948e6a308d1c2e55

Notes to study code #1:
1. Read string class in C++:
http://www.cplusplus.com/reference/string/string/string/
std::string::string
fill(6) string(size_t n, char c)
fill constructor

Fills the string with n consecutive copies of character c.

2. std::string::c_str
http://www.cplusplus.com/reference/string/string/c_str/

3. hexmap[128]

ASCII table from 0 -128
http://www.asciitable.com/

4. reverse in C++  - function template

http://www.cplusplus.com/reference/algorithm/reverse/

5. write string to stdout
http://www.cplusplus.com/reference/cstdio/puts/

http://stackoverflow.com/questions/25311011/how-does-include-bits-stdc-h-work-in-c

statistics:
1. over 300 submission scores 50/50 - Choose 50 submission to study

blog reading:
https://zhuanlan.zhihu.com/qinchao

No comments:

Post a Comment