java implementation for cracking the coding interview