MAQ Software Interview Question

tree based