再问个Amazon面试题# JobHunting - 待字闺中
f*e
1 楼
Given a matrix you have to find the shortest path from one point to another
within the matrix. The cost of path is all the matrix entries on the way.
You can move in any direction (up, down, left, right, diagonally)
e.g.
5 9 10 1
3 7 4 4
8 2 1 9
比如要从(0,0)到(2,2)
路径是(0,0)->(1,0)->(2,1)->(2,2)
cost: 5+3+2+1 = 11.
这个题是DP?贪婪算法?还是NP?
within the matrix. The cost of path is all the matrix entries on the way.
You can move in any direction (up, down, left, right, diagonally)
e.g.
5 9 10 1
3 7 4 4
8 2 1 9
比如要从(0,0)到(2,2)
路径是(0,0)->(1,0)->(2,1)->(2,2)
cost: 5+3+2+1 = 11.
这个题是DP?贪婪算法?还是NP?