Optimal Bst Problem Using Dynamic Programming