Skip to content

Commit 3ecdbd0

Browse files
committed
Refactor PowerSum algorithm implementation and documentation
1 parent 1447db4 commit 3ecdbd0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/main/java/com/thealgorithms/backtracking/PowerSum.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
package com.thealgorithms.backtracking;
2+
3+
4+
/**
5+
* Problem Statement:
6+
* Find the number of ways that a given integer, N, can be expressed as the sum of the Xth powers
7+
* of unique, natural numbers.
8+
* For example, if N=100 and X=3, we have to find all combinations of unique cubes adding up to 100.
9+
* The only solution is 1^3 + 2^3 + 3^3 + 4^3. Therefore, the output will be 1.
10+
*
11+
* N is represented by the parameter 'targetSum' in the code.
12+
* X is represented by the parameter 'power' in the code.
13+
*/
114
public class PowerSum {
215

316
/**

0 commit comments

Comments
 (0)