CarGurus Interview Question

Building of a tree structure