This is just a simple high-school algebra problem. People really ask this in programming interviews?
If I were asking someone this, I'd react pretty negatively to the binary-search solution -- any competent engineer should realize there's a simple closed-form solution.
This is just a simple high-school algebra problem. People really ask this in programming interviews?
If I were asking someone this, I'd react pretty negatively to the binary-search solution -- any competent engineer should realize there's a simple closed-form solution.
It's an easy question though. Can be asked in phone screen or as a warm up question.