Skip to main content
Describe Part 2 of the problem more fully.
Source Link
Booboo
  • 3.7k
  • 4
  • 15
  1. Find the sum of all lines that has a syntax error (corrupted), where every bracket that causes a syntax error is given a particular value.
  2. FindFor each line that was incomplete, completehas a syntax error compute the string of closing characters that when appended to the line and findwill make the autocomplete score ofline syntactically correct (i.e. "complete"). We then compute for this closing string an autocomplete score as follows: We set the completed portionscore initially to 0. For every line inThen for each character of the test dataclosing string, we weremultiply the score by 5 and then askedadd to it a point value associated with the closing character. Finally find the median of all the autocomplete scores where the number of such scores is guaranteed to be odd.
  1. Find the sum of all lines that has a syntax error (corrupted), where every bracket that causes a syntax error is given a particular value.
  2. Find each line that was incomplete, complete the line and find the autocomplete score of the completed portion. For every line in the test data, we were then asked to find the median of the autocomplete scores.
  1. Find the sum of all lines that has a syntax error (corrupted), where every bracket that causes a syntax error is given a particular value.
  2. For each line that has a syntax error compute the string of closing characters that when appended to the line will make the line syntactically correct (i.e. "complete"). We then compute for this closing string an autocomplete score as follows: We set the score initially to 0. Then for each character of the closing string, multiply the score by 5 and then add to it a point value associated with the closing character. Finally find the median of all the autocomplete scores where the number of such scores is guaranteed to be odd.
Became Hot Network Question
Became Hot Network Question
added 4 characters in body
Source Link
toolic
  • 15.8k
  • 6
  • 29
  • 217
  1. Find the sum of all lines that has a syntax error (corrupted), where every bracket that causes a syntax error is given a particular value.
  2. Find each line that was incomplete, complete the line, and find the autocomplete score of the completed portion. For every line in the test data, we were then asked to find the median of the autocomplete scores.
  1. Find the sum of all lines that has a syntax error (corrupted), where every bracket that causes a syntax error is given a particular value.
  2. Find each line that was incomplete, complete the line, find the autocomplete score of the completed portion. For every line in the test data we were then asked to find the median of the autocomplete scores.
  1. Find the sum of all lines that has a syntax error (corrupted), where every bracket that causes a syntax error is given a particular value.
  2. Find each line that was incomplete, complete the line and find the autocomplete score of the completed portion. For every line in the test data, we were then asked to find the median of the autocomplete scores.
Spelling and grammar
Source Link
Toby Speight
  • 88.3k
  • 14
  • 104
  • 327

Bracket matching - Advent of Code 2021 Day 10

Examples of valid pairpairs of brackets

{([(<{}[<>[]}>{[]{[(<()> -  # Expected ], but found } instead.
[[<[([]))<([[{}[[()]]] -    # Expected ], but found ) instead.
[{[{({}]{}}([{[{{{}}([] -   # Expected ), but found ] instead.
[<(<(<(<{}))><([]([]() -    # Expected >, but found ) instead.
<{([([[(<>()){}]>(<<{{ -    # Expected ], but found > instead.
[({(<(())[]>[[{[]{<()<>> -   # Complete by adding }}]])})].
[(()[<>])]({[<{<<[]>>( -     # Complete by adding )}>]}).
(((({<>}<{<{<>}{[]{[]{} -    # Complete by adding }}>}>)))).
{<[[]]>}<{[{[{[]{()[[[] -    # Complete by adding ]]}}]}]}>.
<{([{{}}[<[[[<>{}]]]>[]] -   # Complete by adding ])}>.

Advent of code 10 was divided into two problems:

  1. Find the sum of all lines that has a syntax error (corrupedcorrupted), where every bracket that causes a syntax error is given a particular value.
  2. Here we had to findFind each line that was incomplete, complete the line, find the autocomplete score of the completed portion. For every line in the testdatatest data we were then asked to find the median of the autocomplete scores.

Advent of Code 2021 Day 10

Examples of valid pair of brackets

{([(<{}[<>[]}>{[]{[(<()> - Expected ], but found } instead.
[[<[([]))<([[{}[[()]]] - Expected ], but found ) instead.
[{[{({}]{}}([{[{{{}}([] - Expected ), but found ] instead.
[<(<(<(<{}))><([]([]() - Expected >, but found ) instead.
<{([([[(<>()){}]>(<<{{ - Expected ], but found > instead.
[({(<(())[]>[[{[]{<()<>> - Complete by adding }}]])})].
[(()[<>])]({[<{<<[]>>( - Complete by adding )}>]}).
(((({<>}<{<{<>}{[]{[]{} - Complete by adding }}>}>)))).
{<[[]]>}<{[{[{[]{()[[[] - Complete by adding ]]}}]}]}>.
<{([{{}}[<[[[<>{}]]]>[]] - Complete by adding ])}>.

Advent of code 10 was divided into two problems

  1. Find the sum of all lines that has a syntax error (corruped), where every bracket that causes a syntax error is given a particular value
  2. Here we had to find each line that was incomplete, complete the line, find the autocomplete score of the completed portion. For every line in the testdata we were then asked to find the median of the autocomplete scores.

Bracket matching - Advent of Code 2021 Day 10

Examples of valid pairs of brackets

{([(<{}[<>[]}>{[]{[(<()>   # Expected ], but found } instead.
[[<[([]))<([[{}[[()]]]     # Expected ], but found ) instead.
[{[{({}]{}}([{[{{{}}([]    # Expected ), but found ] instead.
[<(<(<(<{}))><([]([]()     # Expected >, but found ) instead.
<{([([[(<>()){}]>(<<{{     # Expected ], but found > instead.
[({(<(())[]>[[{[]{<()<>>    # Complete by adding }}]])})].
[(()[<>])]({[<{<<[]>>(      # Complete by adding )}>]}).
(((({<>}<{<{<>}{[]{[]{}     # Complete by adding }}>}>)))).
{<[[]]>}<{[{[{[]{()[[[]     # Complete by adding ]]}}]}]}>.
<{([{{}}[<[[[<>{}]]]>[]]    # Complete by adding ])}>.

Advent of code 10 was divided into two problems:

  1. Find the sum of all lines that has a syntax error (corrupted), where every bracket that causes a syntax error is given a particular value.
  2. Find each line that was incomplete, complete the line, find the autocomplete score of the completed portion. For every line in the test data we were then asked to find the median of the autocomplete scores.
added 93 characters in body
Source Link
138 Aspen
  • 469
  • 2
  • 8
Loading
Source Link
138 Aspen
  • 469
  • 2
  • 8
Loading