3 ms·
You 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 d
by xiphias 11y ago
You 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)