3
def __init__(self, capacity: int):6
self.capacity = capacity8
def push(self, val: int) -> None:10
index = heapq.heappop(self.heap)11
if index < len(self.stacks):12
self.stacks[index].append(val)16
lastStack = self.stacks[-1]17
if len(lastStack) != self.capacity:22
self.stacks.append(stack)26
self.stacks.append(stack)30
lastStack = self.stacks[-1]40
def popAtStack(self, index: int) -> int:41
if index == len(self.stacks) - 1:43
if index < len(self.stacks):44
stack = self.stacks[index]47
heapq.heappush(self.heap, index)52
# Your DinnerPlates object will be instantiated and called as such:53
# obj = DinnerPlates(capacity)56
# param_3 = obj.popAtStack(index)