Q3 Hints
Try to use hints only when you really need help! The hints are arranged in order.
Hint 1
This can be achieved using a Flood fill algorithm, but you must add your own custom checks regarding the depth level, and change the notion of "same colour" to "obstacle".
Hint 2
Encountering a timeout on your code for more complex cases? Perhaps consider how efficient your current algorithm is. Does it constantly excessively waste time computing something that would be overwritten later? Is there a way to minimize this wastage in computational time?