Solutions to the common Interview questions Based on Trees