Given an mxn grid of 0s,1s and 2s (0 denoting an obstacle, 1 denoting empty cell and 2 denoting cell with gold). Find the path used to reach from (0,0) to (m - 1, n - 1) collecting maximum gold if you are allowed to travel in any four directions and can take a maximum of k steps.
Given {operator - precedence - explanation} :
a. '!' -1 - x!y = (y - x) % 10007
b. '@' -1 - x@y = (x + y) % 10007
c. '#' - 2 - x#y = (xxy) % 10007
d. '′−2−xy = (xyy) % 10007
Operators with higher precedence have higher priority. Operators with precedence 1 are calculated from left to right and those with precedence 2 are calculated right to left. Operations in paranthesis() have higher priority. Given an expression consisiting of the operators, paranthesis and digits, find it's result.
Eg. 1!(21)=1Eg.12#3 = 144