Leetcode 2787. Ways to Express an Integer as Sum of Powers
Count the number of ways to write n as a sum of distinct positive integers raised to the x-th power (order irrelevant), returning the count modulo 1e9+7. This is a subset-sum / knapsack counting problem over the set of k^x (with small n and x), typically solved with recursion+memoization or DP.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.