Google onsite: Max path from entry row to exit row
Anonymous User
4625

Given a matrix, we can consider any point on the first row as entry point and any point on last row as exit point. # is a wall and . is empty space. Find the path with max length. You can only go down, right or left and visit each cell only once.

I gave a DFS brute force approach but the interviewer wanted a DP solution.

eg matrix:

"#.#..#",
"#.#..#",
"#.##.#",
"#..#.#",
"#..#.#",
"#..#.#"
Comments (15)