r/programming • • May 30 '19

20+ String Coding Interview Questions for Programmers

https://hackernoon.com/20-string-coding-interview-questions-for-programmers-6b6735b6d31c
0 Upvotes

4 comments sorted by

2

u/NedDasty May 30 '19

In the solution to the first example, "How do you reverse a string in place?", they provide a solution that uses a temporary variable, which I would consider as violating the premise of "in-place." There are implementations of swap that don't use a temporary variable (e.g. the xor swap algorithm) which seems more to the letter of the interview question.

3

u/Thaxll May 30 '19

Good luck doing that with utf 8.

2

u/maxhaton May 31 '19

i18n doesn't exist and I will never need to do it...

1

u/slaymaker1907 Jun 01 '19

The xor thing is honestly just a stupid tricky which has questionable performance on modern hardware. Their solution uses O(1) memory which is what I would consider in place. I think it is fairly common to call solutions which use up to O(log n) memory in place, for example with quicksort which uses extra memory due to the implicit stack to support non-tail recursion.