func minIncrements(n int, cost []int) int { ans := 0 for i := (n >> 1); i > 0; i-- { left, right := cost[(i<<1)-1], cost[i<<1] if left > right { left, right = right, left } cost[i-1] += right ans += right - left } return ans }
func abs(num int) int { if num >= 0 { return num } return -num }