Notes:
A good examples of .filter_map() / .unzip() to parse a stream into two vectors for subsequent independent sorting.
Part2: big_gaps_undamped() shows a good used of Itertools::tuple_window()
I was stuck until experimented with many_till.
fn parse_instr(input: &str) -> IResult<&str, (u32, u32)> {
let (remain, (_junk, instruction)) = many_till(anychar, parse_mul)(input)?;
Ok((remain, instruction))
}
Part 1: A beautiful example of a handcrafted Generator ( Well in RUST I implemented this as a iterator! )
Part 2: Operators Add, Mul, Merge
A good use of Itertools::multi_cartesian_product() Future Refactor: A run time of 2sec implies that I need to investigate performance. All the main loop look like they could be simplified by using fold and in particular reduce(). Also my nom parser could be rewritten.
Makes use of Iterrools::cartesian_product. The correct data structure is :-
let map: HashMap<char, HashSet<(usize, usize)>>
Want to return to this problem and visualize the walk.
A good examples of a Linked List.
part 1 just copied the list. part 2 is a walker over the linked list with insertions behind.