Python 3 + Prefix Sum & Binary Search Explanation
Since the question asks us to sample a random point in the available space marked out by the rectangles with a uniform probability, we need to weight our choice
* Since the question asks us to sample a random point in the available space marked out by the rectangles **with a uniform probability**, we need to weight our choice of which rectangle to pick a random point from by its area.\n\t* Therefore this question can be reduced to a weighted probability selection question.\n\t* I.e. A bigger rectangle (in terms of area) should be proportionately more likely to be selected than a smaller one.\n* For readability you can delegate methods to do with rectangles into a `Rectangle` class.\n* We use a `prefixAreaSum` array that is just a prefix sum array of all rectangles\' areas.\n\t* We will use this `prefixAreaSum` array as a way of choosing a specific rectangle to sample a random point from.\n* We can weight our selection of rectangles by area by:\n\t1. Selecting a random number between 0 and the `totalAreaSum`.\n\t2. Searching for the nearest index that has that random number (using binary search, `bisect` in Python).\n\t3. Getting the rectangle corresponding to the index in the `prefixAreaSum` array and getting a random point from it.\n```\nfrom typing import Tuple\nfrom random import randint\nfrom bisect import bisect\n\nclass Rectangle:\n    \n    def __init__(self, x1: int, y1: int, x2: int, y2: int):\n        self.x1 = x1\n        self.y1 = y1\n        self.x2 = x2\n        self.y2 = y2\n\n    def getRandomPoint(self) -> Tuple[int, int]:\n        return (randint(self.x1, self.x2), randint(self.y1, self.y2))\n    \n    def getArea(self) -> int:\n        return (self.x2 - self.x1 + 1) * (self.y2 - self.y1 + 1)\n\nclass Solution:\n\n    def __init__(self, rects: List[List[int]]):\n        self.rectangles = [Rectangle(x1, y1, x2, y2) for x1, y1, x2, y2 in rects]\n\n        currentAreaSum = 0\n        self.prefixAreaSum = []\n        for rectangle in self.rectangles:\n            currentAreaSum += rectangle.getArea()\n            self.prefixAreaSum.append(currentAreaSum)\n            \n        self.totalAreaSum = self.prefixAreaSum[-1]\n            \n            \n    def pick(self) -> List[int]:\n        index = bisect(self.prefixAreaSum, randint(0, self.totalAreaSum))\n        return self.rectangles[min(index, len(self.prefixAreaSum) - 1)].getRandomPoint()\n```
[]