The TransCompilator

Solved LeetCode program · 937 of 1,000

#1301 · Number of Paths with Max Score

Hard Array chunk-19.md

Original English source

The board is a list of "E23", "2X2", and "12S". The cells is an empty list of whole numbers.
For each band in board.
For every column from 0 to 2.
The symbol is character column of band. If symbol is "X", Place -1 into cells. If symbol is "E", Place 0 into cells. If symbol is "S", Place 0 into cells. If symbol is between "0" and "9", The amount is the digit value of symbol, Place amount into cells.

The scores is a list of 9 zeros. The ways is a list of 9 zeros.
For every offset from 0 to 8.
The spot is 8 minus offset. If item spot of cells is -1, set item spot of scores to -1.
If item spot of cells is not -1.
If spot is 8, set item spot of ways to 1.
If spot is not 8.
The best is -1. The count is 0. If spot plus 3 is at most 8 and item (spot plus 3) of scores is more than best, set best to item (spot plus 3) of scores. If spot modulo 3 is less than 2 and item (spot plus 1) of scores is more than best, set best to item (spot plus 1) of scores. If spot plus 3 is at most 8 and item (spot plus 3) of scores is best and item (spot plus 3) of scores is at least 0, set count to count plus item (spot plus 3) of ways. If spot modulo 3 is less than 2 and item (spot plus 1) of scores is best and item (spot plus 1) of scores is at least 0, set count to count plus item (spot plus 1) of ways. If best is at least 0, set item spot of scores to best plus item spot of cells. If best is at least 0, set item spot of ways to count.

Show item 0 of scores. Show item 0 of ways.

Open in Playground Browse all 1,000 problems

Expected stdout

7
1