Advent of Code for R users | Emil Hvitfeldt | Data Science Lab
Автор: Posit PBC
Загружено: 2026-01-12
Просмотров: 1108
The Data Science Lab is a live weekly call. Register at pos.it/dslab! Discord invites go out each week on lives calls. We'd love to have you!
The Lab is an open, messy space for learning and asking questions. Think of it like pair coding with a friend or two. Learn something new, and share what you know to help others grow.
On this call, Libby Heeren is joined by Posit engineer Emil Hvitfeldt as he walks through Day 1 of Advent of Code 2026 using R. This is a super friendly, collaborative, and cheery intro to AoC! Don't forget, you can do Advent of Code at any ole time of year 😉
Hosting crew from Posit: Libby Heeren, Isabella Velasquez, Daniel Chen, Emil Hvitfeldt
Emil's socials and urls:
website: https://emilhvitfeldt.com/
GitHub: https://github.com/emilhvitfeldt
Bluesky: https://bsky.app/profile/emilhvitfeld...
LinkedIn: / emilhvitfeldt
Resources from the hosts and chat:
🔗 Advent of Code: https://adventofcode.com/
🔗 Install Positron: https://positron.posit.co/
🔗 Eric Wastl, Advent of Code: Behind the Scenes: • Eric Wastl – Advent of Code: Behind the Sc...
🔗 AoC Subreddit: / adventofcode
🔗 Kieran Healy shared a reddit post with an Advent of Code answer done in Minecraft: / 2025_day_01_part_2_advent_of_code_in_minec...
🔗 Emil’s Solutions: https://github.com/EmilHvitfeldt/rsta...
🔗 Emil’s helper package: https://github.com/EmilHvitfeldt/aocfuns
🔗 purrr::accumulate() function: https://purrr.tidyverse.org/reference...
And, for anyone hangin' in there at the end, Emil updated us on Discord that he figured out why his cumsum() didn't work: he forgot to start the dial at 50! Once you fix that, it works to solve part 1 :)
► Subscribe to Our Channel Here: https://bit.ly/2TzgcOu
Follow Us Here:
Website: https://www.posit.co
The Lab: https://pos.it/dslab
Hangout: https://pos.it/dsh
LinkedIn: / posit-software
Bluesky: https://bsky.app/profile/posit.co
Thanks for learning with us! 💛
Timestamps
00:00 Introduction
01:01 Tour of the Advent of Code website
02:30 Dashboard overview and puzzle schedule
03:23 How to view and access previous years' events
03:37 Structure of puzzles: Two parts and stars
04:40 Understanding the global leaderboard
05:08 "Does that ASCII art build itself?
06:16 Setting up private leaderboards for friend
07:54 Starting Day 1: Story prompt and mechanics
09:30 Understanding unique puzzle inputs
10:51 Submission feedback and delay penalties
11:44 Safe dial logic: Left, Right, and circularity
12:50 Starting position and Part 1 success criteria
14:09 Setting up the project in Positron
16:26 Strategy for speed: Reading from the bottom up
18:49 Problem-solving strategies: Pen, paper, and visualization
19:22 Walking through the logic with a sample case
20:52 Coding Part 1: Data parsing and vectorization
23:17 Positron keyboard shortcuts for duplicating lines
24:40 Debugging the logic and handling negative numbers
26:03 Explaining the Modulo operator (%%)
28:15 Managing large inputs of over 4,000 instructions
29:21 Submitting Part 1 and transitioning to Part 2
32:03 Part 2 challenge: Counting zero "clicks"
34:02 Brainstorming Part 2 code modifications
36:19 Checking important warnings for edge cases
37:00 Coding Part 2: Nested loops and incrementing counters
38:23 Hint: Modulo vs. integer division
40:40 Success with the Part 2 test case
42:30 Alternative method: Vectorized cumulative sums
45:29 "What's the difference between % and %%?" (percent vs modulo)
46:50 Mathematical optimization to avoid inner loops
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: