Trains the technique from
LeetCode 963Minimum Area Rectangle IIThis 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.
A set of pin positions is given as points, each [x, y], and all of them are distinct.
A frame is four of those pins forming a rectangle. The rectangle's sides need not run along the axes, so a slanted rectangle counts.
Return the smallest area any frame can have, or 0.0 when no four pins form a rectangle. An answer within 1e-5 of the true value is accepted.
Example 1
The four pins form a rectangle standing at a slant. Its two diagonals both run between the midpoint 7, 7.5 and are the same length, and its sides measure 5 and 10, so the area is 50.
Example 2
Every pin sits on one line, so no four of them form a rectangle.
Example 3
The smallest rectangle takes two neighbouring columns of pins, giving sides of 1 and 1.
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 smallest_slanted_frame(points: list[list[int]]) -> float:public double smallestSlantedFrame(List<List<Integer>> points)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.