Available question text
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.
Related questions
Continue with questions that share topics or the same question type.
- Check if Number is a Sum of Powers of Three
Coding
- Convert Integer to the Sum of Two No-Zero Integers
Coding
- Find the Sum of Subsequence Powers
Coding
- Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Walk through Kadane's algorithm and explain the O(n) approach.
Coding
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2787. Ways to Express an Integer as Sum of Powers
Interview date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source