ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

Xah Talk Show Ep724 Wolfram Language, Advent of Code 2025, Day 2

Автор: Xah Lee

Загружено: 2025-12-12

Просмотров: 161

Описание: Introduction to the Problem (0:56-5:00): Xah introduces the Advent of Code Day 2 problem, which involves identifying "invalid product IDs" within given numerical ranges. An invalid ID is defined as a number made only of some sequence of digits repeated twice (e.g., 55, 6464, 123123). Numbers with leading zeros are explicitly stated as not being valid IDs. The task is to find all invalid IDs within specified ranges and sum them up.

Understanding the Invalid ID Pattern (5:25-7:27): Xah notes that if a number has an odd number of digits, it cannot be an invalid ID because a repeated sequence will always result in an even number of digits. He then considers using regular expressions to identify the pattern of repeated digits.

Initial Regular Expression Attempt and Debugging (14:30-46:27): Xah attempts to craft a regular expression using StringMatchQ in Wolfram Language. He encounters unexpected "true" results for patterns that shouldn't match, leading to a long debugging session. He also tries to replicate the issue in Python.

Discovery of Regular Expression Nuances (46:27-56:01): Through the debugging process, Xah realizes two key things:

In Wolfram Language, StringMatchQ requires the pattern to match the entire string, making the ^ (beginning) and $ (end) anchors redundant for this specific function.

The core of the issue was that d+ (one or more digits) followed by d+ was matching any two sequences of digits, even if they were different (e.g., "123" was matching "1" then "23" as two sequences), due to the non-specific nature of the d+ pattern.

Corrected Regular Expression (56:01-59:31): Xah corrects the regular expression by using a capturing group (d+) for the first sequence and then referring back to that captured group with 1 for the second sequence. This ensures that the exact same sequence of digits is repeated (e.g., (d+)1). This corrected regex successfully identifies the invalid IDs.

Further Problem Analysis and Input Handling (1:05:04-1:07:48): Xah reviews the problem statement again and notes that the restriction about leading zeros is effectively redundant because the input ranges are numerical, not string-based, so numbers naturally wouldn't have leading zeros. He then prepares to process the input by splitting the string of ranges.

Beginning of Wolfram Language Implementation (1:08:01-1:18:02): Xah starts coding the solution in Wolfram Language. The plan involves splitting the input string by commas, then splitting each resulting string by a dash to get the start and end of each range. He then intends to generate all numbers within each range and apply the validated regular expression. He briefly discusses the Apply function and its shortcut @@ in Wolfram Language, explaining its use to convert a list of two numbers into arguments for the Range function.

Notes at
http://xahlee.info/talk_show/xah_talk...
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.

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
Xah Talk Show Ep724 Wolfram Language, Advent of Code 2025, Day 2

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

Полная история программирования, Часть 2: BASIC, язык C, создание ООП (с разбором кода)

Полная история программирования, Часть 2: BASIC, язык C, создание ООП (с разбором кода)

Nowa Strategia Bezpieczeństwa USA. Co naprawdę planuje Trump | Salonik polityczny Ziemkiewicza

Nowa Strategia Bezpieczeństwa USA. Co naprawdę planuje Trump | Salonik polityczny Ziemkiewicza

Ep720 Wolfram Language, Advent of Code 2025, Day 1

Ep720 Wolfram Language, Advent of Code 2025, Day 1

Xah Talk Show Ep723 Wolfram Language, Advent of Code 2025, Day 1, Problem 2, take 2

Xah Talk Show Ep723 Wolfram Language, Advent of Code 2025, Day 1, Problem 2, take 2

ObservableObject in SwiftUi

ObservableObject in SwiftUi

Xah Talk Show Ep707 Ultimate Hacking Keyboard UHK 80 Review in Depth

Xah Talk Show Ep707 Ultimate Hacking Keyboard UHK 80 Review in Depth

Программирование на ассемблере без операционной системы

Программирование на ассемблере без операционной системы

Принц Персии: разбираем код гениальной игры, вытирая слезы счастья

Принц Персии: разбираем код гениальной игры, вытирая слезы счастья

ESP32 + MLX90640: тепловизор с искусственным интеллектом (TensorFlow Lite)

ESP32 + MLX90640: тепловизор с искусственным интеллектом (TensorFlow Lite)

Xah Talk Show Ep721 Wolfram Language, Advent of Code 2025, Day 1, Problem 2

Xah Talk Show Ep721 Wolfram Language, Advent of Code 2025, Day 1, Problem 2

ЕС всерьез готовится к войне с РФ?

ЕС всерьез готовится к войне с РФ?

Data Structure and Algorithm Patterns for LeetCode Interviews – Tutorial

Data Structure and Algorithm Patterns for LeetCode Interviews – Tutorial

Ep706 Fold and Reduce, in Wolfram Language, Emacs Lisp, JavaScript

Ep706 Fold and Reduce, in Wolfram Language, Emacs Lisp, JavaScript

ЗАЧЕМ ОНИ ЭТО ДЕЛАЮТ?! 7 СТРАННЫХ привычек американцев, которые ТЕБЯ ШОКИРУЮТ!

ЗАЧЕМ ОНИ ЭТО ДЕЛАЮТ?! 7 СТРАННЫХ привычек американцев, которые ТЕБЯ ШОКИРУЮТ!

Xah Talk Show Ep717 Wolfram Language, Write Costume Function to Convert 2d Graphics to SVG

Xah Talk Show Ep717 Wolfram Language, Write Costume Function to Convert 2d Graphics to SVG

КАК НЕЛЬЗЯ ХРАНИТЬ ПАРОЛИ (и как нужно) за 11 минут

КАК НЕЛЬЗЯ ХРАНИТЬ ПАРОЛИ (и как нужно) за 11 минут

4 часа Шопена для обучения, концентрации и релаксации

4 часа Шопена для обучения, концентрации и релаксации

Japan Starts New Robotic Trend | Best Tech at IREX Expo

Japan Starts New Robotic Trend | Best Tech at IREX Expo

Xah Talk Show Ep713 Wolfram Language. Tuples, Array Dimensions, Depth Level Spec

Xah Talk Show Ep713 Wolfram Language. Tuples, Array Dimensions, Depth Level Spec

Antigravity A1 — Самый НЕВЕРОЯТНЫЙ дрон, который я когда-либо тестировал

Antigravity A1 — Самый НЕВЕРОЯТНЫЙ дрон, который я когда-либо тестировал

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]