mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 16:26:47 +08:00
Style Changed as per guidelines
This commit is contained in:
@ -4,11 +4,11 @@
|
||||
*/
|
||||
|
||||
function zeroOneKnapsack (arr, n, cap, cache) {
|
||||
if (cap == 0 || n == 0) {
|
||||
if (cap === 0 || n === 0) {
|
||||
cache[n][cap] = 0
|
||||
return cache[n][cap]
|
||||
}
|
||||
if (cache[n][cap] != -1) {
|
||||
if (cache[n][cap] !== -1) {
|
||||
return cache[n][cap]
|
||||
}
|
||||
if (arr[n - 1][0] <= cap) {
|
||||
@ -44,7 +44,7 @@ function main () {
|
||||
while (i < length) {
|
||||
const cap = Number(input[i].trim().split(' ')[0])
|
||||
const currlen = Number(input[i].trim().split(' ')[1])
|
||||
let j = i + 1;
|
||||
let j = i + 1
|
||||
const arr = []
|
||||
while (j <= i + currlen) {
|
||||
arr.push(input[j])
|
||||
|
Reference in New Issue
Block a user