@@ -15,9 +15,9 @@ public class PowerSum {
15
15
/**
16
16
* Calculates the number of ways to express the target sum as a sum of Xth powers of unique natural numbers.
17
17
*
18
- * @param targetSum The target sum to achieve (N in the problem statement)
19
- * @param power The power to raise natural numbers to (X in the problem statement)
20
- * @return The number of ways to express the target sum
18
+ * targetSum The target sum to achieve (N in the problem statement)
19
+ * power The power to raise natural numbers to (X in the problem statement)
20
+ * The number of ways to express the target sum
21
21
*/
22
22
public int powSum (int targetSum , int power ) {
23
23
return sumRecursive (targetSum , power , 1 , 0 );
@@ -26,11 +26,11 @@ public int powSum(int targetSum, int power) {
26
26
/**
27
27
* Recursively calculates the number of ways to express the remaining sum as a sum of Xth powers.
28
28
*
29
- * @param remainingSum The remaining sum to achieve
30
- * @param power The power to raise natural numbers to (X in the problem statement)
31
- * @param currentNumber The current natural number being considered
32
- * @param currentSum The current sum of powered numbers
33
- * @return The number of valid combinations
29
+ * remainingSum The remaining sum to achieve
30
+ * power The power to raise natural numbers to (X in the problem statement)
31
+ * currentNumber The current natural number being considered
32
+ * currentSum The current sum of powered numbers
33
+ * The number of valid combinations
34
34
*/
35
35
private int sumRecursive (int remainingSum , int power , int currentNumber , int currentSum ) {
36
36
int newSum = currentSum + (int ) Math .pow (currentNumber , power );
0 commit comments