day_9

Functions

pub fn defragment(
  blocks: #(
    Dict(Int, Int),
    List(Int),
    List(Int),
    Dict(Int, #(Int, Int)),
    Dict(Int, Int),
  ),
) -> #(
  Dict(Int, Int),
  List(Int),
  List(Int),
  Dict(Int, #(Int, Int)),
  Dict(Int, Int),
)

Reorder blocks so that the first gap key is larger than all content keys

pub fn get_blocks(
  disk_map: String,
) -> #(
  Dict(Int, Int),
  List(Int),
  List(Int),
  Dict(Int, #(Int, Int)),
  Dict(Int, Int),
)

Gets blocks from disk map Ints over 0 represent block ids, -1 represents free space

pub fn get_checksum(
  blocks: #(
    Dict(Int, Int),
    List(Int),
    List(Int),
    Dict(Int, #(Int, Int)),
    Dict(Int, Int),
  ),
) -> Int
pub fn get_content(
  blocks: #(
    Dict(Int, Int),
    List(Int),
    List(Int),
    Dict(Int, #(Int, Int)),
    Dict(Int, Int),
  ),
) -> List(Int)
pub fn get_smallest_gap_key(
  blocks: #(
    Dict(Int, Int),
    List(Int),
    List(Int),
    Dict(Int, #(Int, Int)),
    Dict(Int, Int),
  ),
) -> #(Int, List(Int))
pub fn is_defragmented(
  blocks: #(
    Dict(Int, Int),
    List(Int),
    List(Int),
    Dict(Int, #(Int, Int)),
    Dict(Int, Int),
  ),
) -> Bool
pub fn main() -> Nil
pub fn move_last_block_to_smallest_gap(
  blocks: #(
    Dict(Int, Int),
    List(Int),
    List(Int),
    Dict(Int, #(Int, Int)),
    Dict(Int, Int),
  ),
) -> #(
  Dict(Int, Int),
  List(Int),
  List(Int),
  Dict(Int, #(Int, Int)),
  Dict(Int, Int),
)
pub fn part_1() -> Int
pub fn part_2() -> List(Int)
pub fn sort_by_key(a: #(Int, a), b: #(Int, a)) -> Order
Search Document