Given N axis-aligned rectangles where N > 0, determine if they all together form an exact cover of a rectangular region.
Each rectangle is represented as a bottom-left point and a top-right point. For example, a unit square is represented as [1,1,2,2]. (coordinate of bottom-left point is (1, 1) and top-right point is (2, 2)).
classSolution { public: boolisRectangleCover(conststd::vector<std::vector<int>>& rectangles){ int left = INT_MAX; int right = INT_MIN; int top = INT_MIN; int bottom = INT_MAX; autoset = std::set<std::pair<int, int>>{}; int sumArea = 0; for(auto& rectangle : rectangles) { left = std::min(left, rectangle[0]); right = std::max(right, rectangle[2]); top = std::max(top, rectangle[3]); bottom = std::min(bottom, rectangle[1]);