Pergunta de entrevista da empresa Netflix

Implement atoi and itoa

Respostas da entrevista

Sigiloso

27 de set. de 2010

Seriously? They ask that for senior software engineer job? lame q.

1

Sigiloso

27 de set. de 2010

Yep (cuz i sat in that room, too)... over and over, same questions, like they all read the same book. Thing is they aren't doing that stuff day to day.... and the heavy heavy emphasis on "performance" is a little funny. These aren't space ships they're controlling, just transactions.

Sigiloso

23 de out. de 2010

atoi: #include #include #include int main() { const char* s = "12345"; int sum = 0; int len = strlen(s); int multiplier = pow(10, len - 1); for (int i = 0;i < len;i++) { sum += (s[i] - '0') * multiplier; multiplier = multiplier / 10; } printf("%u\n", sum); }

Sigiloso

14 de dez. de 2010

int atoi(const char* s) { int sum = 0; for (char* x = s; x != ']0'; ++x) { sum = sum*10 + *x - '0'; } return sum; }

Sigiloso

14 de dez. de 2010

typo: for (char* x = s; *x != '\0'; ++x) {