Samsung Electronics Interview Question

basic question on arrays and trees