Exploring all paths , and storing maximum value in DP table to avoid further repetitive recursive calls
dp [ l , r , num ] = current_sum + Math . Max ( MaximumScoreDP ( l + 1 , r , prefix_sum , num + 1 ) , MaximumScoreDP ( l , r - 1 , prefix_sum , num + 1 ) ) ; return dp [ l , r , num ] ; }