Sixt Interview Question

2 LC medium questions, trees, graphs