Oracle Interview Question

Bst problem. Dp problem and general tech