Starbucks interview question

Leet Code Easy Problem study those, linked tree