There are really many ways in which one could solve this puzzle. I'll just point out a couple. The trick was generating an inverse of the number.
a. float result = Math.exp(Math.log(a) - Math.log(b))
b. float result = a * Math.pow(b, -1)
There were two bonus points on offer for getting a solution without using any class additional class except java.lang.Object. Lots of folks came up with the solution which was basically using an alternate notation for the '/' sign.
return a \u002F b;
No comments:
Post a Comment
Solution for this question?