Watch and track your favorite playlist.
Curated by: Xah Lee (862 videos)
Solving Advent of Code 2025, Day 3 (0:04), I'm working in Wolfram Language to extract two digits from a given number that form the largest possible number (1:53-2:10). My approach: First, I convert the number to a list of digits using IntegerDigits (4:08). Then, I find the largest digit, excluding the last one, from this list using Drop and Max (7:33-8:25). I get its Position (9:02) and use it to select the remaining digits, finding the second largest digit from those (10:09-12:20). Finally, I combine these two chosen digits into a number using FromDigits (12:06). I built an extractMaxTwoDigits function (13:02) and tested it with examples (23:34). After a fix for how Position handles duplicate digits (31:43), the code produced the correct sum for the sample inputs (25:00). I then used the larger official input (26:27), and the solution (17766) was successfully submitted (36:02). I also showed a more "pure functional" version of the code, eliminating local variables (38:50). Notes at http://xahlee.info/talk_show/xah_talk_show_ep727.html If browser says security error, that is because it auto changes URL from HTTP to HTTPS. It's a way to censor 22 million old websites. Remove the S in HTTPS. Or use brave browser or safari.