Company: Visa_6nov
Difficulty: medium
Maximum Value from Matrix Expressions Problem Description Given a non-empty matrix puzzle of characters consisting of only single digits, + , and - values. Your task is to return the maximum value which is evaluated using a valid expression from the puzzle . It is guaranteed that at least one numeric value will be present in the puzzle . A valid expression satisfies all the conditions stated below: Starts from any cell with a numeric value. From the starting cell, it goes only from left to right, or only top to the bottom, without changing the direction in the middle. The final expression doesn't contain any consecutive operators (e.g. 3 + - 2 is not correct). The final expression doesn't contain any consecutive numeric values (e.g. 3 + 4 4 is not correct). Note: You are not expected to provide the most optimal solution, but a solution with time complexity not worse than O(puzzle.length 2 * puzzle[0].length 2 ) will fit within the execution time limit. Examples Example 1: Input: puzzle