"Cracking the Coding Interview" answers, but in JavaScript instead of Java.