ABC interview question

Expected leaves