Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function pow(num: int, exp: int): int {
- return pow_r(num, num, exp);
- }
- function pow_r(num: int, base: int, exp: int): int {
- if (exp == 0) return 1;
- else if (exp == 1) return num;
- return pow_r(num * base, base, --exp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement