(Replying to PARENT post)

Implementing Atoi is a fine interview question imo.
πŸ‘€google234123πŸ•‘3yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

I would classify atoi() as a mediocre question at best.

I would look for the following in a "fine" question:

1. It demonstrates knowledge of fundamental concepts or techniques.

2. It lets you distinguish the quality of answer/implementation rather than just works or doesn't.

3. It leads to natural follow-up questions that can demonstrate the candidate's knowledge or expertise.

4. It does not require fiddly code. (e.g. linked list pointer twiddling questions: they aren't hard but are easy to muck up with a stranger staring at you.)

5. If its unrelated to what candidates normally work on, the question should not hinge on knowing a specialized "trick" to change difficulty from hard to easy.

Atoi under that criteria:

1. Does not show much interesting besides a basic understanding of decimal numbers and writing loops.

2. It's hard to imagine much variability in the quality of responses. A "real" atoi implementation is not interview material: https://github.com/golang/go/blob/master/src/strconv/atoi.go...

3. I guess you could follow it up with questions on testing and error handling. Nothing super interesting comes to mind, but that could be lack of imagination on my part.

4. It meets this criteria.

5. It meets this criteria.

Perhaps you have some particularly good way of posing an atoi() question.

πŸ‘€nieksandπŸ•‘3yπŸ”Ό0πŸ—¨οΈ0

(Replying to PARENT post)

> What’s the fastest way to convert a string to number? And other unspecified behavior.

This really says nothing about the contents of the string. Is it decimal, then maybe they want atoi. They could be looking for a hash of the string as well. Or the levenshtein distance to the word "walrus". Or really, any number of functions that convert a string to a number.

πŸ‘€marginalia_nuπŸ•‘3yπŸ”Ό0πŸ—¨οΈ0