【Leetcode-python】11. Container With Most Water(盛最多水的容器)

題目:給定n個非負的整數a1, a2, ..., an,(i, ai) and (i, 0)分別代表座標(i, ai)。連接(i, ai) and (i, 0)畫直線,共有n條。找出兩條直線,使得兩條直線與x軸形成的容器能夠盛最多的水。 例: Input: [1,8,6,2,5,4,8,3,7]     Output: 49 思路:這道題最簡單的方法就是雙層暴力循環法,使用兩個for循環依次取出左
相關文章
相關標籤/搜索