Inficare interview question

Tree structure