← 返回 capitalone 的题目列表Matrix operation maximum value - digit, +, -, right or down, can't change direction
类型:online_judge
Given a matrix containing digits and operators (+ and -), you can start from the top-left corner, and only move right or down, without changing direction, find the maximum value path from top-left to bottom-right.
Example
Matrix:
[["3", "+", "2", "-", "2"],
["5", "-", "", "+", "4"],
["3", "+", "2", "-", "1"]]
Allowed one path: 3 -> + -> 2 -> - -> 2 -> + -> 4.
Output
Maximum value: 5
Example
Input
[["3", "+", "2", "-", "2"], ["5", "-", "0", "+", "4"], ["3", "+", "2", "-", "1"], ["3", "-", "2", "-", "2"]]
Output
5