Company: Visa_6nov
Difficulty: medium
Maximum Value from Matrix Expressions You are given a grid puzzle with R rows and C columns. Every cell holds exactly one character: a single digit '0' – '9' , a plus sign '+' , or a minus sign '-' . At least one cell holds a digit. Read a valid expression off the grid like this: Pick a starting cell that holds a digit . Move either only rightwards along that row, or only downwards along that column. The direction is fixed when you start and never changes, and you may stop at any point. Write down the characters of the cells you pass through, in order. The result must be a well-formed expression: it must alternate digit, operator, digit, operator, …, and it must end on a digit . So it may not contain two operators in a row ( 3 + - 2 is not allowed) and it may not contain two digits in a row ( 3 + 4 4 is not allowed). A single digit cell, on its own, is already a valid expression. The value of an expression is what you get by applying its + and - operations from left to right. Each digi