GoConqr has a new look! Let us know what you think.

Flashcards

Pow(x, n)

Suhas S English 1 card

Cards in this deck (1)

  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;
    }
    }
    }

Information

Description
Flashcards on Pow(x, n), created by Suhas S on 23/03/2018.
Created by
Suhas S · Mar 2018
Updated
Jun 4, 2018
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?