Uploads from Xah Lee

Watch and track your favorite playlist.

Curated by: Xah Lee (862 videos)


Currently Playing: Xah Ep733 Wolfram Language, Advent of Code 2025, Day 5

Video Summary (Generated by AI, Edited by Human.) In this video, Xah Lee tackles Day 5 of the Advent of Code 2025 challenge using the Wolfram Language (0:06). The problem involves an inventory management system where elves need to determine which "available ingredient IDs" are "fresh" (2:16). Here's a breakdown of the video: Problem Description (1:48): The core task is to process a database containing a list of fresh ingredient ID ranges (e.g., 3 to 5, 10 to 14) and a separate list of available ingredient IDs. An ingredient is considered "fresh" if its ID falls within any of the defined fresh ranges (5:56). The goal is to count how many of the available ingredient IDs are fresh (7:32). Concepts and Definitions (3:42): Xah clarifies three main concepts: Ingredient ID: A unique identifier for an ingredient. Available: Refers to the list of ingredient IDs the elves currently have. Fresh: Determined by whether an ingredient ID falls within any of the inclusive fresh ID ranges (5:42). Keyboard and System Digressions (4:18, 30:30): The video includes brief digressions where Xah answers a question about his Ultimate Hacking Keyboard 80 vs. Glove 80, noting his comfort with both, and discusses his recent Windows 11 upgrade experience. Solution Approach in Wolfram Language (32:59): Xah demonstrates how to solve the problem using the Wolfram Language. He first explains the parsing of the input data from a text file into a list of ranges and a list of IDs (20:18). The core of his solution relies on the Select function (42:58). This function is used to efficiently check if an ID falls within any of the fresh ranges without needing explicit loops or recursion. If an ID is within a range, Select returns that range; otherwise, it returns an empty list. He then maps this logic to each available ID: if Select returns a range, it's counted as 1 (fresh); if it returns an empty list, it's 0 (spoiled) (52:51). Finally, the total count of fresh ingredients is obtained by summing these 1s and 0s (54:44). Result (59:18): Using his personal input data, the solution correctly identifies 611 fresh available ingredients, which is confirmed as the right answer for the Advent of Code problem. Conclusion and Support (1:02:07): Xah concludes by summarizing the elegant Wolfram Language solution and invites viewers to support his work through Patreon, Amazon gift cards, or PayPal. Notes at http://xahlee.info/talk_show/xah_talk_show_ep733.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.


Tracks in this Playlist