UBS interview question

Coding question on binary search tree .