C++ String Interview Question

后端 未结 7 1233
悲哀的现实
悲哀的现实 2021-02-13 18:22

I was recently in a C++ technical interview, where I was given a bit of simple string manipulation code, which is intended to take a string and return a string that is comprised

7条回答
  •  广开言路
    2021-02-13 19:07

    My only thought is that if this function is only called with C null-terminated strings, you might be requiring the extra construction of a std::string for parameter 's'.

    Possibly the 'more' efficient method would be to allow either a std::string or const char *s passed in.

提交回复
热议问题