Question Bank

Numeric Puzzles and FizzBuzz Challenges

Difficulty: Medium

Six numeric warm-ups: recursive exponent, random sampling, prime check, recursive 1..n, completing missing numbers, and iterative Fibonacci.

Question Bank
/

Numeric Puzzles and FizzBuzz Challenges

Numeric Puzzles and FizzBuzz Challenges

Six numeric warm-ups: recursive exponent, random sampling, prime check, recursive 1..n, completing missing numbers, and iterative Fibonacci.

Question Bank
Medium
JavaScript
6 questions
quiz
math
loops
interview-prep

1,152 views

5

Implement exponent(a, n) without using Math.pow or **. Recursion is fine for small n; describe the limit.

Examples

Example 1:

Input: exponent(4, 2), exponent(2, 10)
Output: 16, 1024
Explanation: a^n = a * a^(n-1); base case is n = 0 returning 1.