KLA Interview Question

Questions from graph and dp