X interview question

Leetcode interview questions rather medium than hard using DFS/BFS