iCIMS interview question

the algorithm for building the arithmetic tree