module AdventOfCode
Extended Modules
Defined in:
advent-of-code-20.crcrystal/01.cr
crystal/02.cr
crystal/03.cr
crystal/04.cr
crystal/05.cr
crystal/06.cr
crystal/07.cr
crystal/08.cr
crystal/09.cr
crystal/10.cr
crystal/11.cr
crystal/12.cr
crystal/13.cr
crystal/14.cr
crystal/15.cr
crystal/16.cr
Class Method Summary
Instance Method Summary
- #expense_report(num, arr : Array(T)) : T forall T
- #jolt_differences(input : String)
-
#jolt_permutations(input : String)
There are only differences of 1 or 3.
- #passports(input) : Array(Passport)
- #run_10_1
- #run_10_2
- #run_11_1
- #run_11_2
- #run_12_1
- #run_12_2
- #run_13_1
- #run_13_2
- #run_14_1
- #run_14_2
- #run_15_1
- #run_15_2
- #run_16_1
- #run_16_2
- #run_1_1
- #run_1_2
- #run_2_1
- #run_2_2
- #run_3_1
- #run_3_2
- #run_4_1
- #run_4_2
- #run_5_1
- #run_5_2
- #run_6_1
- #run_6_2
- #run_7_1
- #run_7_2
- #run_8_1
- #run_8_2
- #run_9_1
- #run_9_2
- #valid_password(password : String) : Bool
- #valid_password_2(password : String) : Bool
Class Method Detail
Instance Method Detail
def jolt_permutations(input : String)
#
There are only differences of 1 or 3. There are no permutations when the difference is 3. The numbers of permutations depends on the size of the group of 1s. We take the number of all possible skips (2^(n-2)) and subtract the impossible the n-2 is because the first and last element can be ignored for this method
We don't actually do this yet, and brute force it instead because I couldn't figure out a formula for number of impossible sequences.