Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
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.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.