Karteikarten
Pow(x, n)
Karten in diesem Stapel (1)
- 1Input: 2.00000, 10 Output: 1024.00000 Input: 2.10000, 3 Output: 9.26100class Solution {
public double myPow(double x, int n) {
if(n == 0 ) return 1;
double temp = myPow(x,n/2);
if(n % 2 == 0 ) return temp * temp;
else{
if( n > 0 ){
return x*temp*temp;
}else
return (temp*temp)/x;
}
}
}
Informationen
- Beschreibung
- Karteikarten am Pow(x, n), erstellt von Suhas S am 23/03/2018.
- Erstellt von
- Suhas S · Mär 2018
- Aktualisiert
- 4 Jun 2018
- Aufrufe
- 0
- Bewertung