Module day10

Module day10 

Source
Expand description

ยงSyntax Scoring

This day is a variation of the classic parentheses balancing problem. To solve we use a vec as a stack, pushing opening delimiters onto the stack, then popping the top of the stack whenever we encounter a closing delimiter. If there is a mismatch between opening and closing delimiters then we return the specified error value immediately.

For part two the completion score is the remaining items on the stack, reversed and converted from corresponding closing delimiters. For example the completion string ])}> would have a stack that looks like <{([, where the right hand side is the top of the stack.

Functionsยง

autocomplete_score ๐Ÿ”’
parse
part1
part2
syntax_score ๐Ÿ”’

Type Aliasesยง

Input ๐Ÿ”’