由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 请教一个C++的题目
相关主题
C++中parse string的问题 (转载)有人来我脸吗
Samsung实习电话面试吐槽一下某初创公司
一周多了。。。等的太不淡定了。。。 说两个面经吧问一个不知道算是软工还是C++的面试题
问个弱问题:为啥要设立throw exception这种机制呢?请问一道c++题目
MS onsite面经Leetcode 大侠,加上 C++11 support 吧
how to parse json to csv , using python?面试 Expectation 问题
被问到一道题: how to design a xml parser.这题怎么解好?
租房网电面一题求讨论一道SYSTEM DESIGN题,CC10.1
相关话题的讨论汇总
话题: c++话题: parser话题: string话题: stl话题: regex
进入JobHunting版参与讨论
1 (共1页)
o*********7
发帖数: 101
1
Write a parser for the following format
( a, b ):( c, d ):( e, f ):...
assume the data resides in a std::string
What data structure will you parse it into and outline your parser.
对STL不算太熟悉,稍微知道一点点
不知道是放在map里面比较好还是放在list里面更合适
请指教,非常感谢
m*f
发帖数: 8162
2
I would first ask the interviewer if I am allowed to use the newer version
of C++, which includes a regex, then it's going to be pretty simple - just
match and search.
If this is not the case, when I would first split string by ":", and then
split string by ",". You may want to ask if you need to handle things like:
(hello:world, 1):(information:retrieval, 2):(apple:rotton, 3):...
If this is the case, then it's a bit more complicated, you will want to
implement a bottom-up regular expression parser...

【在 o*********7 的大作中提到】
: Write a parser for the following format
: ( a, b ):( c, d ):( e, f ):...
: assume the data resides in a std::string
: What data structure will you parse it into and outline your parser.
: 对STL不算太熟悉,稍微知道一点点
: 不知道是放在map里面比较好还是放在list里面更合适
: 请指教,非常感谢

q*i
发帖数: 78
3
why not use "):(" as delimiter

like:

【在 m*f 的大作中提到】
: I would first ask the interviewer if I am allowed to use the newer version
: of C++, which includes a regex, then it's going to be pretty simple - just
: match and search.
: If this is not the case, when I would first split string by ":", and then
: split string by ",". You may want to ask if you need to handle things like:
: (hello:world, 1):(information:retrieval, 2):(apple:rotton, 3):...
: If this is the case, then it's a bit more complicated, you will want to
: implement a bottom-up regular expression parser...

m*f
发帖数: 8162
4
It's pretty fragile..

【在 q*i 的大作中提到】
: why not use "):(" as delimiter
:
: like:

h*****3
发帖数: 1391
5
没看懂你的题。。。输入是啥,输出是啥?
w****f
发帖数: 684
6
请教,哪个版本C++ 有regex? what is regex?

like:

【在 m*f 的大作中提到】
: I would first ask the interviewer if I am allowed to use the newer version
: of C++, which includes a regex, then it's going to be pretty simple - just
: match and search.
: If this is not the case, when I would first split string by ":", and then
: split string by ",". You may want to ask if you need to handle things like:
: (hello:world, 1):(information:retrieval, 2):(apple:rotton, 3):...
: If this is the case, then it's a bit more complicated, you will want to
: implement a bottom-up regular expression parser...

d****n
发帖数: 1637
7
STL stack

【在 o*********7 的大作中提到】
: Write a parser for the following format
: ( a, b ):( c, d ):( e, f ):...
: assume the data resides in a std::string
: What data structure will you parse it into and outline your parser.
: 对STL不算太熟悉,稍微知道一点点
: 不知道是放在map里面比较好还是放在list里面更合适
: 请指教,非常感谢

C***U
发帖数: 2406
8
用map怎么样?
第一位是key
第二位是value

【在 o*********7 的大作中提到】
: Write a parser for the following format
: ( a, b ):( c, d ):( e, f ):...
: assume the data resides in a std::string
: What data structure will you parse it into and outline your parser.
: 对STL不算太熟悉,稍微知道一点点
: 不知道是放在map里面比较好还是放在list里面更合适
: 请指教,非常感谢

w********s
发帖数: 1570
9
std::pair
1 (共1页)
进入JobHunting版参与讨论
相关主题
求讨论一道SYSTEM DESIGN题,CC10.1MS onsite面经
一个很全SAS Interview Q. List [ZT]how to parse json to csv , using python?
print a BST level by level, last row first被问到一道题: how to design a xml parser.
讨论个题目吧租房网电面一题
C++中parse string的问题 (转载)有人来我脸吗
Samsung实习电话面试吐槽一下某初创公司
一周多了。。。等的太不淡定了。。。 说两个面经吧问一个不知道算是软工还是C++的面试题
问个弱问题:为啥要设立throw exception这种机制呢?请问一道c++题目
相关话题的讨论汇总
话题: c++话题: parser话题: string话题: stl话题: regex