开发者

Classic string manipulation interview questions? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 8 years ago.

Improve this question

I am scheduled to have an onsite interview so I am preparing few basic questions. According to the company profile, they are big on string manipulation questions. So far I have manually开发者_StackOverflow社区 coded these functions:

  1. String length, copy, concat, remove white space
  2. Reverse
  3. Anagrams
  4. Palindrome

Can someone give me a list of more classic string questions which I can practice before going there?


They might ask you about regular expressions. If they are using Java, they might ask the difference of StringBuffer and StringBuilder.


Reverse words in a sentence, e.g.

"string manip interview question"

becomes

"question interview manip string"

this has a solution that uses only one char worth of temporary space.


Make sure your reversal is in-place. You didn't state, so perhaps it already is.

Asking you to re-implementing strstr() or strtok() might be up their alley too, I guess.

UPDATE: As a bonus, if you do end up re-implementing either of those, remember to not name your functions starting with str, since that namespace is reserved. Having a candidate display that knowledge in an interview would impress me, at least. :)


Fast search like Boyer-Moore and Knuth-Morris-Pratt. Fast strlen by examining more than one byte at a time. Simultaneously finding multiple strings in a large body of text with Rabin-Karp. Finding nearest matches with things like Levenshtein distance. Regular expressions and how they might implement parts of it. Various unicode and other multibyte string encodings and how to convert between them.


Design a regular expression library.


Check this out. Might not fit the description for 'classic', but very interesting.


I'd look up string algorithms in a good algorithm book. For example, the Boyer-Moore algorithm, Tries, Suffix Trees, Minimum Edit Distance, stuff like that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜