I want to find a way in which we can score each tree by summing the scores of its spans and choose the highest scoring binary tree that maximizes the sum by backtracking.