4 ms·
Maybe they think "it can't be so simple question, it's GOOGLE, maybe they ask for the most fast and efficient algorithm of existing..."
by EugeneOZ 12y ago
Maybe they think "it can't be so simple question, it's GOOGLE, maybe they ask for the most fast and efficient algorithm of existing..."
- xiphias 12y agoYou can ask how efficient it needs to be. The interview is always a 2-way conversation. For example you can tell that you can check whether the string size is divisible by 4/8 and use built-in CPU instructions that convert between big-endian and little-endian ordering. Still, generally what's more important for me to see that the person who is interviewed checks all the edge cases (sees the difference between odd and even length strings, and makes sure that trivial cases, like 0 or 1 byte/character long string work as well)
- S4M 12y agoI would be wary about that too, but I would rather answer with the first algorithm that comes to my mind, without worrying about efficiency yet, and if the interviewer ask me for something more efficient, well, then I would start digging.