Demandbase interview question

Balance a bst