Glencore interview question

a graph and tree question