check if the current digit of the cube matches with that of the number num
if ( num . charAt ( j ) == currCube . charAt ( index ) ) { index ++ ; } if ( digitsInCube == index ) { return currCube ; } } }