amazon 电面面经

原帖地址:一亩三分地

发个 amazon 电面面经,没写出来, 后来在 careercup 发现了 这道题。好坑啊http://www.careercup.com/question?id=5725353829990400

Given a 2 dimensional matrix where some of the elements are filled with 1 and rest of the elements
are filled. Here X means you cannot traverse to that particular points. From a cell you can either traverse to left, right, up or down
Given two points in the matrix find the shortest path
between these points

For example if the matrix is
1 1 1 1 1
S 1 X 1 1
1 1 1 1 1
X 1 1 E 1
1 1 1 1 X

Here S is the starting point and E is the Ending point