Motadata Interview Question

tree based question and other one is map based.