Re: Short and easy to understand solution

following code passes case of '2.0000, Integer.MIN_VALUE'.

public double myPow(double x, int n) {

if(x == 0) return 0;

if(n == 0) return 1;

```
if(n == 0) return 1;
if(n < 0){
n = -n;
if(n >= 0)//need to check if it's MIN_VALUE, if it is, don't flip yet. Next recursion will do.
x = 1 / x;
}
return (n % 2 == 0 ? 1 : x) * myPow(x * x, n / 2);
}
```