Samsung Electronics Interview Question

BFS in a 2d matrix