Interview Questions

Quickly calculate the cube root of 6 digit numbers

The is a clever interview question that asks you to calculate the cube root of a number quickly. We can solve this by some mathematical tricks that won't require any calculates to take place, only table lookups. This algorithm will focus on calculating the cube root of 6 digit numbers (or less). For example, if the input is **636056** then your program should output **86**.
## Algorithm

You need to be a premium member to see the rest of this question and code.

With our large collection of challengs, tutorials, and solutions, we make it easy for you to become a better coder, prepare for interviews, and learn new skills from more experienced coders.

- 200+ Coding Challenges
- Mock Interview Questions
- 500,000+ Code Solutions
- Algorithm Tutorials
- Interview Prep Courses

mrdaniel
published this on 11/24/15 **|**

0

@numbergames, yes this is more of a clever trick to quickly calculcate the cube root of larger numbers. In reality you would just implement a fast (liner time or sublinear time) algorithm to calculcate any cube root.

mrdaniel

commented on 09/29/16

0

This is a neat trick, but does it have any practical application? The link, unless I missed something, has examples of much more general answers to the question.
The impractical aspect of the above approach is that it gives arbitrarily wrong answers if the input is not an exact cube. Seems like know that a number is an exact cube is a harder question that getting the cube root once you already know that.
Am I missing something or is this just a fun trick?

numbergames

commented on 09/29/16

Login to submit a comment