Company: Autodesk SDE intern on campus_9april
Difficulty: medium
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). Please see the video for valid and invalid expression examples. Note: If you are unable to view the video properly, please use this link to access it. Note: You are not expected to provide the most optimal solution, but a solution with time complexity not worse than O(puzzle.length 2 * puz