I have tried to provide a solution for AdventOfCode2023 with my test cases in Python
Day | Problem1 | Problem2 |
---|---|---|
day1 | part1 | part2 |
day2 | part1 | part2 |
day3 | part1 | part2 |
day4 | part1 | part2 |
day5 | part1 | |
day6 | part1 | part2 |
day7 | part1 | part2 |
day8 | part1 | part2 |
day9 | part1 | part2 |
day10 | part1 | |
day11 | part1 |
Check from left, if a number is found added it as msb. Similarly checking from right hand side, adde number as lsb.
Convert all spelled out numbers into digits and run the same algo as in part1.
Compare each game with the given threshold of {'red': 12, 'green': 13, 'blue': 14}
balls.
Take the maximum of each color of ball for each game to find the least number of balls available.
For each number in given input check all neighbouring values, if a special character is present, add to sum.
For each *
symbol present create a set of neighbouring numbers and multiply the numbers where lenght of the set is 2. To avoid duplicate/multiple same entries set is used and to avoid missing two same values we use index as well while saving in set.
Find number of common elements in given numbers and winning numbers. Add to sum the 2's power of the count.
Maintain a cache with 1 depicting 1 card at the beginning. Calculating count the same way as in part 1, we update cache for that many cards after current card.
Calculate location value for each seed-range and find minimum of those locations.
For every given time since the speed of boat is same as the time for which the button is held down, this means if the button is held for x seconds, the time availble is (t-x) seconds. Calculate product where the record can be beaten.
Using the same logic as in part1, just combine the given times and distances.
Sort the different card hands based on first the hand type then card type. Here Ive created a class for a card hand and created a priority list, with first value as the hand type and second as card type. Sorting uses these priority list as key.
Update the priority of 'J' Card in Card priority map. For any hand having 'J' cards, 'J' cards are converted to type of card which has the largest count. Then priority list is calculated for the updated hand.
Starting from 'AAA' loop through the map following the directions till 'ZZZ' is not reached.
Calculate length of path for each starting values ending with 'A' and ending values ending with 'Z' and calculate the least common multiple for all these values.
For each list in input, recursively find the list where each value is zero, from that point return recursive value received + the last value of list passed to that recursive fn.
For each list in input, recursively find the list where each value is zero, from that point return the first value of list passed to that recursive fn - recursive value received.
Since it is given that the there is a closed loop, we travel from one path end to the other path end and count the total steps. Finally divide the number of steps by 2 to get to the farthest point.
To expand the list, expand each row, and for expanding the columns transpose the list. Find the manhatten distance between each point, for the extended list.