1
0
Fork 0
mirror of https://gitlab.com/mfocko/LeetCode.git synced 2024-11-14 01:49:41 +01:00
LeetCode/cpp/widest-vertical-area-between-two-points-containing-no-points.cpp
Matej Focko b229608723
cpp(chore): add clang-format style and format
Signed-off-by: Matej Focko <me@mfocko.xyz>
2024-01-03 12:06:54 +01:00

21 lines
479 B
C++

#include <algorithm>
#include <set>
class Solution {
public:
int maxWidthOfVerticalArea(const std::vector<std::vector<int>> &points) {
std::set<int> seen;
for (const auto &point : points) {
seen.insert(point[0]);
}
int last = *seen.begin();
int max_width = 0;
for (const auto x : seen) {
max_width = std::max(max_width, x - last);
last = x;
}
return max_width;
}
};