Giter VIP home page Giter VIP logo

advent_of_code_2023's Introduction

Advent of Code - 2023

https://adventofcode.com/2023

===========================

--- Day 1: Trebuchet?! ---

Full description: 2023 Day 1

My solution: day_one.js

Language: JavaScript

--- Part One ---

What is the sum of all the calibration values in your document, where each value is determined by combining the first digit and the last digit of each line into a two-digit number?

Example:

  • 1abc2 --------- 12
  • pqr3stu8vwx --- 38
  • a1b2c3d4e5f --- 15
  • treb7uchet ---- 77

Sum: 142

--- Part Two ---

What is the sum of all calibration values in your document, where each value is determined by identifying the real first and last digit (including those spelled out as words) on each line and combining them into a two-digit number?

Example:

  • two1nine ----------- 29
  • eightwothree ------- 83
  • abcone2threexyz ---- 13
  • xtwone3four -------- 24
  • 4nineeightseven2 --- 42
  • zoneight234 -------- 14
  • 7pqrstsixteen ------ 76

Sum: 281

--- Day 2: Cube Conundrum ---

Full description: 2023 Day 2

My solution: day_two.py

Language: Python

--- Part One ---

Determine which games, from a list where each game shows different sets of colored cubes, would have been possible with a bag containing only

  • 12 red cubes
  • 13 green cubes
  • 14 blue cubes

For each game, check if any set of cubes shown exceeds these limits. The sum of the IDs of the games that are possible under these conditions is the answer.

Example:

  • Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green
  • Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue
  • Game 3: 8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red
  • Game 4: 1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red
  • Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green

Possible games: 1, 2, 5

Sum of possible game IDs: 8

--- Part Two ---

For each game, determine the minimum number of red, green, and blue cubes that could have been in the bag to make the game possible.

Calculate the power of each game's minimum set of cubes by multiplying the numbers of red, green, and blue cubes together. The final answer is the sum of these powers for all the games.

Example:

Using the same games as above, the minimum sets of cubes for each game are:

  • Game 1: 4 red, 2 green, 6 blue
  • Game 2: 1 red, 3 green, 4 blue
  • Game 3: 20 red, 13 green, 6 blue
  • Game 4: 14 red, 3 green, 15 blue
  • Game 5: 6 red, 3 green, 2 blue

Power of

  • Game 1: 48
  • Game 2: 12
  • Game 3: 1560
  • Game 4: 630
  • Game 5: 36

Sum of powers: 2286

--- Day 3: Gear Ratios ---

Full description: 2023 Day 3

My solution: day_three.py

Language: Python

--- Part One ---

Calculate the sum of all "part numbers" in an engine schematic, where a part number is defined as any number adjacent (including diagonally) to a symbol. Periods (.) do not count as symbols.

Example:

467..114..
...*......
..35..633.
......#...
617*......
.....+.58.
..592.....
......755.
...$.*....
.664.598..

Numbers not adjacent to symbols: 114, 58

Sum of adjacent numbers or "part numbers": 467 + 35 + 633 + 617 + 592 + 755 + 664 + 598 = 4381

--- Part Two ---

Find the gear ratio of every gear in the engine schematic and add them up. A gear is any * symbol that is adjacent to exactly two part numbers. The gear ratio is calculated by multiplying these two part numbers together. In the provided example, there are two gears with gear ratios of 16345 and 451490, respectively. The final answer is the sum of all gear ratios in the schematic.

Example:

Using the same schematic as above, the gear ratios are: 16345, 451490

Sum of gear ratios: 467835

advent_of_code_2023's People

Contributors

hkunzler 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.