Qualcomm Interview Question

stack and head consturct bfs dfs