#include <iostream>
#include <vector>
using namespace std;
int trap(vector<int>& height) {
// TODO: two-pointer approach
return 0;
}
int main() {
vector<int> a = {0,1,0,2,1,0,1,3,2,1,2,1};
vector<int> b = {4,2,0,3,2,5};
cout << trap(a) << endl; // 6
cout << trap(b) << endl; // 9
return 0;
}
Click Run to execute, or Submit to grade (all languages).