Xah Talk Show 2022-12-12 Advent of Code Day 1, in WolframLang, Live Coding
going to do the full advent of code, in different programing languages.
first we gonna do WolframLang. then, maybe also JavaScript, golang, emacs lisp, python.
Problem Description
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
Problem 1 A: given a text of multiple lines, each line is a number. Lines are grouped by a blank line as separater. For each group of lines, find its max, then find maximum of the groups.
Problem 1 B: get the top 3 max of the groups.
xah talk show 2022-12-12 aoc 8G3Hw
xinput = "1000
2000
3000
4000
5000
6000
7000
8000
9000
10000" ;
xresult = Total /@ ToExpression @ (StringSplit /@ StringSplit [ xinput , "\n\n" ])
xAnswer1 = Max [ xresult ]
xAnswer2 = Total @ TakeLargest [ xresult , 3 ]