Trains the technique from
LeetCode 939Minimum Area RectangleThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
Pins are placed at the positions pins, where pins[i] = [x, y], and no two pins share a position.
A frame is a rectangle whose four corners are pins and whose sides run parallel to the axes.
Return the smallest area any frame encloses, or 0 when no four pins form one.
Example 1
The four pins are the corners of a square two wide and two tall, enclosing four.
Example 2
Two pins cannot make four corners, so there is no frame at all.
Example 3
Three columns each hold a pin at both heights, and the closest two columns are one apart, giving a frame one wide and one tall.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def min_area_rect(pins: list[list[int]]) -> int:public int minAreaRect(int[][] pins)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.