Update with minimum
ans = max ( ans , left + maxweight ( s , i , pre ) , right + maxweight ( i + 1 , e , pre ) ) NEW_LINE if left > right : NEW_LINE ans = max ( ans , right + maxweight ( i + 1 , e , pre ) ) NEW_LINE