Flipkart | Interview PSDS round

Anonymous User
1142
Oct 06, 2023
Oct 06, 2023

Given a nxm matrix. Given a character 'A' you have tell if there exists a path to reach the right bottom cell. Matrix has some obstacles G you cant cross. you can move in 8 directions. Time complexity should be O(m+n) / O(m*n).

. . . G . .
A . . . . G
. . . . . .
. G . . . .

Optimization: There is a charater S with superpower. If you encounter S you can skip the whole row.
Hint: To collect the location of all G and S which will take mn. After that the function to find if path exist can be done in O(m+n)

Comments (4)