1637.cpp (416B)
1 class Solution { 2 public: 3 int maxWidthOfVerticalArea(const vector<vector<int>> &points) { 4 vector<int> v; 5 v.reserve(points.size()); 6 for (int i = 0; i < points.size(); i++) 7 v.push_back(points[i][0]); 8 sort(v.begin(), v.end()); 9 10 int maxi = 0; 11 for (int k = 1; k < v.size(); k++) 12 maxi = max(maxi, v[k] - v[k - 1]); 13 return maxi; 14 } 15 };