YASH Technologies interview question

Tree and Array based DSA question