advent of code 2023 day 6: use array destructuring
This commit is contained in:
parent
716c36ab61
commit
aa15a877f5
|
@ -1,9 +1,7 @@
|
|||
|
||||
module.exports.solve = function(input) {
|
||||
const toNrs = line => line.split(' ').filter(x => x).slice(1).map(nr => parseInt(nr))
|
||||
const lines = input.split('\n')
|
||||
const times = toNrs(lines[0])
|
||||
const distances = toNrs(lines[1])
|
||||
const [times, distances] = input.split('\n').map(toNrs)
|
||||
|
||||
const numberOfWaysToBeatTheRecord = (time, i) => {
|
||||
const distance = distances[i]
|
||||
|
|
Loading…
Reference in New Issue