aoc-2019-c

Advent of Code 2019 Solutions in C
git clone https://git.sinitax.com/sinitax/aoc-2019-c
Log | Files | Refs | README | sfeed.txt

part2 (1398B)


      1--- Part Two ---
      2
      3Now, you just need to figure out how many orbital transfers you (YOU) need to take to get to Santa
      4(SAN).
      5
      6You start at the object YOU are orbiting; your destination is the object SAN is orbiting. An orbital
      7transfer lets you move from any object to an object orbiting or orbited by that object.
      8
      9For example, suppose you have the following map:
     10
     11COM)B
     12B)C
     13C)D
     14D)E
     15E)F
     16B)G
     17G)H
     18D)I
     19E)J
     20J)K
     21K)L
     22K)YOU
     23I)SAN
     24
     25Visually, the above map of orbits looks like this:
     26
     27                          YOU
     28                         /
     29        G - H       J - K - L
     30       /           /
     31COM - B - C - D - E - F
     32               \
     33                I - SAN
     34
     35In this example, YOU are in orbit around K, and SAN is in orbit around I. To move from K to I, a
     36minimum of 4 orbital transfers are required:
     37
     38
     39 - K to J
     40
     41 - J to E
     42
     43 - E to D
     44
     45 - D to I
     46
     47
     48Afterward, the map of orbits looks like this:
     49
     50        G - H       J - K - L
     51       /           /
     52COM - B - C - D - E - F
     53               \
     54                I - SAN
     55                 \
     56                  YOU
     57
     58What is the minimum number of orbital transfers required to move from the object YOU are orbiting to
     59the object SAN is orbiting? (Between the objects they are orbiting - not between YOU and SAN.)
     60
     61