id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

frew@mclean.com > superPowerRecursive
prev  |  next  |  chance

Give a recursive algorithm whose input is a real number r and a non-negative integer n, and whose output is r^(2 ^ n) . Note that the exponent of r is 2 ^ n. Your algorithm should only use addition and multiplication operations and should not contain any iterative loops.


superPowerRecursive(3, 0) → 3
superPowerRecursive(3, 1) → 9
superPowerRecursive(3, 2) → 81

...Save, Compile, Run (ctrl-enter)

public int superPowerRecursive(int r, int n) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 300 Post-solution available

Copyright Nick Parlante 2017 - privacy