C++ Solution using Binary search with explanation
\nclass Solution {\n    //concept is simple\n    //we need to pick the coordinates from the rectangle space\n    //for that we will use rand() function to find 
```\nclass Solution {\n    //concept is simple\n    //we need to pick the coordinates from the rectangle space\n    //for that we will use rand() function to find out randomly any rectangle\n    //but to which we will apply rand()\n    //that should be cumulative sum of areas why?? because we can\'t use area of any rect that\'s not unique but cumulative sum is unique\n    //area of any rectangle can be given by (x[2]-x[0]+1) * (x[3]-x[1]+1)\n    //we will store this inside a rectangle to store the cumulative sum for each rectange\nprivate:\n    vector<vector<int>> rects;\n    vector<pair<int,int>> sums;\n    int sum = 0;\n    \n    //returns index of random sum if found returns that index else returns lowerBound(index with value not lesser than randomSum)\n    int findIndexOfRandomSum(int randomSum) {\n        int lowerBound = 0, upperBound = sums.size() - 1;\n        while(lowerBound <= upperBound) {\n            int middle = lowerBound + (upperBound - lowerBound)/2;\n            int sumValue = sums[middle].first;\n            if(sumValue > randomSum) {\n                upperBound = middle - 1;\n            } else if(sumValue < randomSum) {\n                lowerBound = middle + 1;    \n            } else {\n                return middle;\n            }   \n        }\n        return lowerBound;     \n    }\n    \npublic:\n    Solution(vector<vector<int>>& rects) {\n        int size = rects.size();\n        this->rects = rects;\n        for(int i = 0; i < size; i++) {\n            int x1 = rects[i][0], x2 = rects[i][2], y1 = rects[i][1], y2 = rects[i][3];\n            sum += ((x2-x1+1)*(y2-y1+1));\n            sums.push_back(make_pair(sum, i));\n        }    \n    }\n    \n    vector<int> pick() {\n        int randomSum = rand()%(sum) + 1; //gives random value from 0 to sum inclusive all\n        int index = findIndexOfRandomSum(randomSum);\n        int x1 = rects[index][0], x2 = rects[index][2], y1 = rects[index][1], y2 = rects[index][3];\n        vector<int> result;\n        result.push_back(x1 + rand()%(x2-x1+1));\n        result.push_back(y1+rand()%(y2-y1+1));\n        return result;     \n    }\n};\n\n/**\n * Your Solution object will be instantiated and called as such:\n * Solution* obj = new Solution(rects);\n * vector<int> param_1 = obj->pick();\n */\n```
[]