双指针,但是更简单。 class Solution { public: long long maxWater(vector<int>& arr) { // write code here int left = 1, right = arr.size() - 2; //hole int h1 = arr[0], h2 = arr[arr.size() - 1]; //border int ans = 0; while (left <= right) { if (arr[left] >= h1) { //h1 update h...