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 questionI 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:
- String length, copy, concat, remove white space
- Reverse
- Anagrams
- 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.
精彩评论