Skip to content

Commit 6136b39

Browse files
committed
Fix unused import in KnapsackMemoization.java
1 parent 2e20e05 commit 6136b39

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/main/java/com/thealgorithms/dynamicprogramming/KnapsackMemoization.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.thealgorithms.dynamicprogramming;
22

3-
import java.lang.reflect.Array;
43
import java.util.Arrays;
54

65
/**
@@ -39,7 +38,6 @@ int solveKnapsackRecursive(int capacity, int[] weights, int[] profits, int numOf
3938
if (weights[numOfItems - 1] > capacity) {
4039
// Store the value of function call stack in table
4140
dpTable[numOfItems][capacity] = solveKnapsackRecursive(capacity, weights, profits, numOfItems - 1, dpTable);
42-
return dpTable[numOfItems][capacity];
4341
} else {
4442
// case 1. include the item, if it is less than the capacity
4543
final int includeCurrentItem = profits[numOfItems - 1] + solveKnapsackRecursive(capacity - weights[numOfItems - 1], weights, profits, numOfItems - 1, dpTable);
@@ -49,7 +47,7 @@ int solveKnapsackRecursive(int capacity, int[] weights, int[] profits, int numOf
4947

5048
// Store the value of function call stack in table and return
5149
dpTable[numOfItems][capacity] = Math.max(includeCurrentItem, excludeCurrentItem);
52-
return dpTable[numOfItems][capacity];
5350
}
51+
return dpTable[numOfItems][capacity];
5452
}
5553
}

0 commit comments

Comments
 (0)