Skip to content

Commit 34c5edd

Browse files
authored
Update Knapsack.java (TheAlgorithms#2137)
1 parent aa8858b commit 34c5edd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

DynamicProgramming/Knapsack.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public static void main(String args[]) {
2626
int val[] = new int[] {50, 100, 130};
2727
int wt[] = new int[] {10, 20, 40};
2828
int W = 50;
29-
int n = val.length;
30-
System.out.println(knapSack(W, wt, val, n));
29+
System.out.println(knapSack(W, wt, val, val.length));
3130
}
3231
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy