diff --git a/day 1/day_1_mark.js b/day 1/day_1_mark.js new file mode 100644 index 0000000000000000000000000000000000000000..0d2c8ede9a8d987d786f912eeaef3335dc15d515 --- /dev/null +++ b/day 1/day_1_mark.js @@ -0,0 +1,8 @@ +a = input.split("\n").map(x => x.split(" ").map(Number)) +b = a.map(x => x[0]).sort() +c = a.map(x => x[1]).sort() +output2 = b.map((x,i) => Math.abs(x - c[i])).reduce((x,y)=>x+y) + +b = a.map(x => x[0]) +c = a.map(x => x[1]) +output2 = b.map(x => x*c.filter(y=>x==y).length).reduce((x,y)=>x+y) \ No newline at end of file