题目解析
本题题解可以参考:盛最多水的容器-CSDN博客
JS算法源码
const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
void (async function () {
const heights = (await readline()).split(",").map(Number);
let i = 0;
let j = heights.length - 1;
let maxArea = 0;
while (i < j) {
let x = j - i; // 高柱~矮柱之间的距离
let y = heights[i] < heights[j] ? heights[i++] : heights[j--]; // 矮柱高度,并移动柱子
maxArea = Math