You are viewing a single comment's thread. Return to all comments →
Python 3 Recursive Solution:
def powerSum(X, N): def dfs(total, power, num_present): val = total - num_present**power if val <= 0: if val == 0: return 1 return 0 return dfs(val, power, num_present+1) + dfs(total, power, num_present+1) return dfs(X, N, 1)
Seems like cookies are disabled on this browser, please enable them to open this website
The Power Sum
You are viewing a single comment's thread. Return to all comments →
Python 3 Recursive Solution: