Function aoc::year2021::day18::parse

source ยท
pub fn parse(input: &str) -> Vec<[i32; 63]>
Expand description

Parse a snailfish number into an implicit binary tree stored in an array.

Since no number will greater than 9 initially we can consider each character individually. [ means moves down a level to parse children, , means move from left to right node, ] means move up a level to return to parent and a digit from 0-9 creates a leaf node with that value.