题目: 题解:
class Solution:def __init__(self, rects: List[List[int]]):self.rects rectsself.sum [0]for a, b, x, y in rects:self.sum.append(self.sum[-1] (x - a 1) * (y - b 1))def pick(self) -> List[int]:k randrange(self.sum[-1…
题目: 题解:
class Solution {Random rand;List<Integer> arr;int[][] rects;public Solution(int[][] rects) {rand new Random();arr new ArrayList<Integer>();arr.add(0);this.rects rects;for (int[] rect : rects) {int a rect[0…