SentinelOne interview question

Standard Coding Question based on Graphs, Trees and their optimizaitons