Fast Exponentiation

Implement a fast exponentiation function to compute base raised to the power of exp (base^exp), given base and exp.

Requirement:

  • Complexity should be O(log exp).
  • Implement using normal multiplic...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: