Exercises/#73 Power Function (Fast Exponentiation)
#73

Power Function (Fast Exponentiation)

MediumπŸ”’ Math & Numbers
70 XP

Problem

Implement pow(x, n) which calculates x raised to the power n. Handle negative exponents.

Examples

Input: x=2.0, n=10
Output: 1024.0

Input: x=2.1, n=3
Output: 9.261

Input: x=2.0, n=-2
Output: 0.25
mathdivide-conquerrecursion
AI Assistantβ€” powered by AI

Unlock hints progressively β€” start gentle, go deeper only if needed.

πŸ’‘

Level 1: Gentle Nudge

A subtle direction

πŸ—ΊοΈ

Level 2: Approach

The algorithm to use

πŸ”

Level 3: Detailed

Step-by-step guidance

73 / 150

Your Solution

⚑ JavaScript

to save progress and use AI features