Add part 2 of day 4, 5, and 6

This commit is contained in:
Wesley Moore 2017-12-09 11:55:56 +10:00
parent f10ec4db0f
commit ed90986668
3 changed files with 29 additions and 0 deletions

View file

@ -12,3 +12,17 @@ For example:
The system's full passphrase list is available as your puzzle input. How many passphrases are valid? The system's full passphrase list is available as your puzzle input. How many passphrases are valid?
--- Part Two ---
For added security, yet another system policy has been put in place. Now, a valid passphrase must contain no two words that are anagrams of each other - that is, a passphrase is invalid if any word's letters can be rearranged to form any other word in the passphrase.
For example:
abcde fghij is a valid passphrase.
abcde xyz ecdab is not valid - the letters from the third word can be rearranged to form the first word.
a ab abc abd abf abj is a valid passphrase, because all letters need to be used when forming another word.
iiii oiii ooii oooi oooo is valid.
oiii ioii iioi iiio is not valid - any of these words can be rearranged to form any other word.
Under this new system policy, how many passphrases are valid?

View file

@ -27,3 +27,11 @@ In this example, the exit is reached in 5 steps.
How many steps does it take to reach the exit? How many steps does it take to reach the exit?
--- Part Two ---
Now, the jumps are even stranger: after each jump, if the offset was three or more, instead decrease it by 1. Otherwise, increase it by 1 as before.
Using this rule with the above example, the process now takes 10 steps, and the offset values after finding the exit are left as 2 3 2 3 -1.
How many steps does it now take to reach the exit?

View file

@ -21,3 +21,10 @@ At this point, we've reached a state we've seen before: 2 4 1 2 was already seen
Given the initial block counts in your puzzle input, how many redistribution cycles must be completed before a configuration is produced that has been seen before? Given the initial block counts in your puzzle input, how many redistribution cycles must be completed before a configuration is produced that has been seen before?
--- Part Two ---
Out of curiosity, the debugger would also like to know the size of the loop: starting from a state that has already been seen, how many block redistribution cycles must be performed before that same state is seen again?
In the example above, 2 4 1 2 is seen again after four cycles, and so the answer in that example would be 4.
How many cycles are in the infinite loop that arises from the configuration in your puzzle input?