about | help | code help+videos | done | prefs |
Define a tail optimised recursive function that when passed two integers (say x and n), returns x to the power of n. You should think of how to make it faster to avoid time-outs and/or StackOverflowErrors. You may not use any loops. fast_power(1, 10000) → 1 fast_power(0, 200000) → 0 fast_power(2, 30) → 1073741824 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 3 Post-solution available
Copyright Nick Parlante 2017 - privacy