Tecnotree interview question

Data structure