GoalScope — largest_rectangle_histogram (Qwen2.5-Coder-32B-Instruct) — hover a token to see the patched verbalization
↵
<code>↵
def largest_rectangle_histogram(heights):↵
"""Largest Rectangle in Histogram"""↵
stack = []↵
max_area = 0↵
index = 0↵
↵
while index < len(heights):↵
if not stack or heights[index] >= heights[stack[-1]]:↵
stack.append(index)↵
index += 1↵
else:↵
top_of_stack = stack.pop()↵
area = (heights[top_of_stack] *↵
((index - stack[-1] - 1) if stack else index))↵
max_area = max(max_area, area)↵
↵
while stack:↵
top_of_stack = stack.pop()↵
area = (heights[top_of_stack] *↵
((index - stack[-1] - 1) if stack else index))↵
max_area = max(max_area, area)↵
↵
return max_area↵
</code>