Skip to content

Commit d11b390

Browse files
committed
Solution for day 14 (2020)
1 parent 1ee35c0 commit d11b390

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

2020/14/index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ function version2(program) {
3131
let [,i,v] = line.match(/mem\[([\d]*)\] = ([\d]*)/)
3232
bin = Number(i).toString(2).padStart(36, '0')
3333
const addressBin = mask.split('').map((m, b) => m === '0' ? bin[b] : m === '1' ? 1 : 'X').join('')
34-
floatingValues(addressBin).forEach(value => {
35-
mem[value] = Number(v)
36-
})
37-
34+
floatingValues(addressBin).forEach(value => mem[value] = Number(v))
3835
}
3936
})
4037
return Object.keys(mem).map(m => mem[m]).reduce((a, b) => a + b, 0)

0 commit comments

Comments
 (0)