Recursive Power
Recursive Power
EasyRecursion28% accepted
Compute B^E using recursion: B^0 = 1, and B^E = B × B^(E-1) for E > 0. This is the same as the iterative power problem but solved recursively. Understanding recursive multiplication is the foundation for fast exponentiation (binary exponentiation).
Approach
Given integers B and E (E >= 0), compute and print B^E using recursion.
Input
0 0
Output
1
More Recursion problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards