GithubHelp home page GithubHelp logo

2023-advent-of-code's Introduction

Advent of Code 2023

(Almost) all of my solutions to the 2023 edition of Advent of Code.

Summary

Advent of Code is a series of Christmas-themed programming challenges from Dec. 1st-25th:

  • At midnight (Eastern), one problem description (in narrative prose), sample input/answer, and input file are posted.
    • Input files are personalized/randomized for each contestant.
  • The contestant submits the answer (usually a 64-bit or less integer) for the given problem and input.
  • When the contestant submits the correct answer, the second challenge's problem description is unlocked.
    • The second challenge usually uses the same input file as the first, but the problem requires interpreting it in a more computationally intensive way.
  • The contestant submits the answer (same format) for the second problem.

My solutions are organized by day, with independent Python files for part 1 and part 2.

Tool-Assisted Solves

In Advent of Code, the contestant only needs to come up with a solution for a single specific, known input, and they do not need to "show their work".
Contrast with LeetCode, etc. where the candidate must provide a self-contained piece of code with limited dependencies that produces the right answers for a test suite of opaque inputs spanning the problem space.
Advent of Code inputs are also sometimes structured to yield an answer more readily than the general formulation presented in the problem.
As such, it lends itself to tool-assisted (semi-automated) solves.

Specific examples:

  • Day 8 Part 2 (solution lost in a Git mishap): My solution here relied on several simplifying aspects of the input data (overall structure, plus position of Z being equal to loop length) to obtain the answer with a plain least common multiple.
    • I think some variation on the Chinese Remainder Theorem would handle cases where the lead-ins and Z positions were less carefully coordinated.
  • Day 21 Part 2: This was an involved Python -> Google Sheets -> Python process (detailed here).
    • The formula derived by polynomial regression could also be found by summing contributions from core (completely reachable) and edge (partially reachable) grid tiles - no Google Sheets required.
    • Thoughts about a potential fully-generalizable solution are in my writeup.
  • Day 24 Part 2: I used sympy to solve a system of equations for a few hailstones.
    • There's presumably an algebraic approach to combining the hailstones' paths without using this library.
  • Day 25 part 1: I found the three edges to cut by graphing it in graphviz and manual inspection.
    • A fully automatic algorithmic approach would probably resemble max-flow/min-cut.

2023-advent-of-code's People

Contributors

russ741 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.