Calculate the power of a given a base, exponent. Return the last n digit number.
Example 1: base = 3; expo = 8; n = 3; 3^8 = 6561 return the last 3 digit number 561.
Example 2: base = 3; expo = 10; n = 3; 3^10 = 59049 return the last 3 digit number 49.
I think the third test case is wrong. Anyone else has problem??
Whoops. The answer needs to be a number, not a string.
great! well done
Admittedly, I know very little about Java but I'm suprised this work since I can't find a constructor that takes a double. Only strings, byte patterns or random number generators. Care to explain?
There are a constructors for int and double: http://docs.oracle.com/javase/1.5.0/docs/api/java/math/BigDecimal.html#BigDecimal(int)
http://docs.oracle.com/javase/1.5.0/docs/api/java/math/BigDecimal.html#BigDecimal(double)
Oh yes, I missed that you were using BigDecimal instead of BigInteger.
i have a 25 sized solution but it doesnt accept since i used symbolic toolbox :)
good effort!
1582 Solvers
Back to basics 4 - Search Path
280 Solvers
157 Solvers
163 Solvers
127 Solvers