Amazon interview question

implement a seach model using bfs