|
|
|
|
|
by ayberk
2238 days ago
|
|
I used to use this question before it became too common. Any reasonably-well-prepared candidate should be able come up with the O(N) solution and the follow-up is always good for a discussion: "what if the string is huge but the alphabet is small? Eg, a DNA sequence." There's a single pass solution that's left as an exercise for the reader. |
|
Isn't that the point? You say it like it's a problem, but it screens for someone who's reasonably prepared, which is probably what Google wants to do because they really start looking for the super-world-tier people they employ, because I guess that takes more time and resources.
> There's a single pass solution that's left as an exercise for the reader.
Doesn't the blog post already include a single-pass solution that works on a small alphabet?