LEETCODE
===
# 1802. Maximum Value at a Given Index in a Bounded Array
看不出來解答為什麼這麼寫
```go=
func maxValue(n int, index int, maxSum int) int {
return sort.Search(maxSum, func(t int) bool {
s := t*t
if a := t - index; a > 1 {
s -= (a - 1) * a / 2
}
if b := t - (n - 1 - index); b > 1 {
s -= (b - 1) * b / 2
}
return s > maxSum - n
})
```
先用 [this](https://leetcode.com/problems/maximum-value-at-a-given-index-in-a-bounded-array/editorial/?envType=daily-question&envId=2023-11-06) 做一次吧
## 543. Diameter of Binary Tree
找的是距離,不是高度