mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 16:26:47 +08:00
Update ZeroOneKnapsack.js
This commit is contained in:

committed by
GitHub

parent
3ab272da4b
commit
3f755cfbda
@ -3,7 +3,7 @@
|
||||
* https://en.wikipedia.org/wiki/Knapsack_problem
|
||||
*/
|
||||
|
||||
function zeroOneKnapsack (arr, n, cap, cache) {
|
||||
const zeroOneKnapsack = (arr, n, cap, cache) => {
|
||||
if (cap === 0 || n === 0) {
|
||||
cache[n][cap] = 0
|
||||
return cache[n][cap]
|
||||
@ -20,7 +20,7 @@ function zeroOneKnapsack (arr, n, cap, cache) {
|
||||
}
|
||||
}
|
||||
|
||||
function main () {
|
||||
const main = () => {
|
||||
/*
|
||||
Problem Statement:
|
||||
You are a thief carrying a single bag with limited capacity S. The museum you stole had N artifact that you could steal. Unfortunately you might not be able to steal all the artifact because of your limited bag capacity.
|
||||
|
Reference in New Issue
Block a user