Skip to content

Commit 5bd7036

Browse files
committed
Formatted Knapsack.java to pass linter and added 0/1 Knapsack algorithm
1 parent 1b9077d commit 5bd7036

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
*/
2424
public final class Knapsack {
2525

26-
private Knapsack() {
27-
}
26+
private Knapsack() {}
2827
/**
2928
* Validates the input to ensure correct constraints.
3029
*/
@@ -65,13 +64,13 @@ public static int knapSack(final int weightCapacity, final int[] weights, final
6564

6665
/**
6766
* Example main method for demonstration.
68-
*/
67+
6968
public static void main(String[] args) {
7069
int[] values = {60, 100, 120};
7170
int[] weights = {10, 20, 30};
7271
int weightCapacity = 50;
7372
7473
int maxValue = knapSack(weightCapacity, weights, values);
7574
System.out.println("Maximum value = " + maxValue); // Output : 220
76-
}
75+
} */
7776
}

0 commit comments

Comments
 (0)