Frage im Vorstellungsgespräch bei SentinelOne

Standard Coding Question based on Graphs, Trees and their optimizaitons