rect is parellel with x, y cord
Never
class Solution { public: double maxAreaRect(vector<vector<double>>& p){ double n = p.size(), max_area = -1; // store max area // key -> x(double), val -> y with same x(unordered_set of double) unordered_map<double, unordered_set<double>> m; // a hash map // use unordered data structure because sorted structure might cost more time when sorting for us for(i = 0; i<n; i++) m[p[i][0]].insert(p[i][1]); for(int i = 0; i < n; i++) { // Iterator corresponding to different A points for(int j = i+1; j < n; j++) { // Iterator corresponding to different B points // find 2 random different points first double x1 = p[i][0], y1 = p[i][1], x2 = p[j][0], y2 = p[j][1]; if(x1 != x2 && y1 != y2){ // if 2 points forms a diagonal // check if the other 2 points of the rectangle exists if(m[x1].count(y2) && m[x2].count(y1)) max_area = max(max_area, abs((x1-x2)*(y1-y2)); } } } return max_area; } };
Raw Text
-
Untitled
20 sec ago
-
Untitled
4 min ago
-
ddsd dsfd fsdfs fdssddfsdf
4 min ago
-
Untitled
6 min ago
-
CP😏 VIDEOS R@PED😈 LITTLE GIRL 🍼👧
23 min ago
-
Adult Telegram Channels
25 min ago
-
sdfsdfdsfsdfsd
39 min ago
-
dsfgbsdfgbnsdf
44 min ago
-
fddfsdsf dsf dfsdf dfsdsf dfs ddsf dfsdfsdf
1 hour ago
-
Pedomom son...... dad....daughter
1 hour ago