xenoteo.com.github └── dayN | ├── input | | └── input.txt | ├── part1 | │ ├── Main.java | │ └── Solution.java | ├── part2 | │ ├── Main.java | │ └── Solution.java | └── README.md └── InputReader.java
In day
packages the one general structure is kept.
In the input
folder there always is the main input.txt
file, but there could be more input samples in other files.
In part1
and part2
folders there are Main.java
and Solution.java
files. The Main
class is always responsible for displaying the problem’s solution. In Solution
class the only public method is the main method implemented to solve the problem, the other methods (if there are) are helpers.
There also provided a README
file to each of the days.
If some special input is provided, in the day package can be located the InputReader.java
class responsible for reading data from the input file of the certain day.
Additionally in the day package (or part of the day package, depending on problem) some helpers classes can also be found.
There is one general InputReader
class, which reads simple input data and is used for many days.
Short descriptions of problems. Complete problem contents can be found in README files of day packages.
- [day 1]
- [day 2] - each line gives the password policy and then the password. Counting how many passwords are valid according to the policies.
- [day 3] - having a map of the open squares (.) and trees (#). These aren't the only trees, though; the same pattern repeats to the right many times.
- [part 1] - counting how many trees can be encountered starting at the top-left corner of the map and following a slope of right 3 and down 1.
- [part 2] - counting how many trees can be encountered starting at the top-left corner of the map and following given slopes, and then multiplying founded results together.
- [day 4] - having a list of passport data counting how many from them are valid.
- [day 5] - decoding airplane pass. Instead of zones or groups, the airline uses binary space partitioning to seat people. A seat might be specified like FBFBBFFRLR, where F means "front", B means "back", L means "left", and R means "right".
- [day 6] - the form asks a series of 26 yes-or-no questions marked a through z. Identifying the questions for which people from a group answered "yes".
- [day 7] - given rules specifying the required contents of colored bags (bags must be color-coded and must contain specific quantities of other color-coded bags).
- [day 8] - the boot code is represented as a text file with one instruction per line of text. Each instruction consists of an operation (acc, jmp, or nop) and an argument (a signed number like +4 or -20). Program contains infinite loop.
- [day 9] - XMAS (eXchange-Masking Addition System) starts by transmitting a preamble of 25 numbers. After that, each number should be the sum of any two of the 25 immediately previous numbers.
- [part 1] - finding the first invalid number, that is number that cannot be made by sum of any two of the 25 immediately previous numbers.
- [part 2] - finding encryption weakness, that is a sum of the smallest and largest number in a contiguous set of at least two numbers in a list which sum to the invalid number.
- [day 10] - given a list of all of the joltage adapters in a bag. Each of joltage adapters is rated for a specific output joltage. Any given adapter can take an input 1, 2, or 3 jolts lower than its rating and still produce its rated output joltage. In addition, the device has a built-in joltage adapter rated for 3 jolts higher than the highest-rated adapter in the bag. The charging outlet has an effective joltage rating of 0.
- [day 11] - the seat layout fits neatly on a grid. Each position is either floor (.), an empty seat (L), or an occupied seat (#). Running seats rearrangements according to required rules. Simulating the seating area by applying the seating rules repeatedly until no seats change state.
- [day 12] - the navigation instructions consists of a sequence of single-character actions paired with integer input values. Finding the Manhattan distance between the final location and the ship's starting position.
- [day 13] - each bus has an ID number that also indicates how often the bus leaves for the airport.
- [part 1] - having the earliest timestamp you could depart on a bus, finding the ID of the earliest bus you can take to the airport multiplied by the number of minutes you'll need to wait for that bus.
- [part 2] - finding the earliest timestamp such that all of the listed bus IDs depart at offsets matching their positions in the list.
- [day 14] - the bitmask is always given as a string of 36 bits, written with the most significant bit on the left and the least significant bit on the right. A bitmask act as a decoder.
- [day 15] - in the game, the players take turns saying numbers. Each turn consists of considering the most recently spoken number. Each turn results in that player speaking aloud either 0 (if the last number is new) or an age (if the last number is a repeat).
- [day 16] - the rules for ticket fields specify a list of fields that exist somewhere on the ticket and the valid ranges of values for each field. Each ticket is represented by a single line of comma-separated values.
- [day 17]
- [day 18] - expressions consist of addition (+), multiplication (*), and parentheses ((...)). Just like normal math, parentheses indicate that the expression inside must be evaluated before it can be used by the surrounding expression. The rules of operator precedence have changed.
- [day 19] - the rules for valid messages are numbered and build upon each other. Determining the number of messages that completely match rule 0.
- [day 20] - the camera array consists of many cameras; rather than produce a single square image, they produce many smaller square image tiles that need to be reassembled back into a single image.
- [day 21] - given the list of ingredients in unknown language and the list of allergens contained by the ingredients in English.
- [day 22]
- [day 23] - playing a game of Crab's mixing cups.
- [day 24]
- [day 25]
- [part 1] - finding the encryption key having the door's and the card's public keys.