题目: 题解:
class Solution:def nextGreaterElement(self, nums1: List[int], nums2: List[int]) -> List[int]:res {}stack []for num in reversed(nums2):while stack and num > stack[-1]:stack.pop()res[num] stack[-1] if stack else -1…
题目: 题解:
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…