function maxArea(height: number[]): number {
  const area = (h, w) => h * w
  const len = height.length
  let max = 0
  let i = 0
  let j = len - 1
  while (i < j) {
    const hi = height[i]
    const hj = height[j]
    const m = area(Math.min(hi, hj), j - i)
    if (m > max) max = m
    if (hi > hj) {
      j--
    } else {
      i++
    }
  }
  return  max
}