Skip to content

Instantly share code, notes, and snippets.

@ryanberry
Created December 2, 2017 08:33
Show Gist options
  • Save ryanberry/5abfa756c45c9afe4b77a4280d75699c to your computer and use it in GitHub Desktop.
Save ryanberry/5abfa756c45c9afe4b77a4280d75699c to your computer and use it in GitHub Desktop.
let table = data.split(/\r?\n/).map(line => line.split(/\t/).map(Number))
let checkSum = table.reduce(
(prev, line) => (prev += Math.max(...line) - Math.min(...line)),
0,
)
console.log(checkSum)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment