Sixt interview question

2 LC medium questions, trees, graphs