Xah Talk Show 2022-12-12 Advent of Code Day 1, in WolframLang, Live Coding

vidthumb nEW0HUhoJlQ

Problem Description

1000
2000
3000

4000

5000
6000

7000
8000
9000

10000
xah talk show 2022-12-12 aoc 8G3Hw
xah talk show 2022-12-12 aoc 8G3Hw
xinput = "1000
2000
3000

4000

5000
6000

7000
8000
9000

10000";

(* x3 = StringSplit /@ StringSplit[ xinput, "\n\n" ] *)
(* x4 = Map[ Function[ x, ToExpression[x] ] , x3 ] *)
(* x5 = Map[ Function[ x, Total[x] ] , x4] *)

xresult = Total /@ ToExpression @ (StringSplit /@ StringSplit[ xinput, "\n\n" ])
xAnswer1 = Max[ xresult ]
xAnswer2 = Total @ TakeLargest[ xresult, 3 ]

2022 Advent of Code