Minimum Area Rectangle II
A medium-tier problem at 56% community acceptance, tagged with Array, Math, Geometry. Reported in interviews at Verily and 0 others.
Minimum Area Rectangle II is a geometry problem that trips up candidates who default to axis-aligned thinking. You're given a set of points and need to find the smallest-area rectangle that can be formed by four of them, but the rectangle can be rotated at any angle. Verily has asked this. It sits at medium difficulty with roughly 55% acceptance, which means half the people who attempt it walk away stuck. The trick isn't computational brute force. It's recognizing the geometric constraint that makes the problem tractable. If you hit this live and blank on the approach, StealthCoder surfaces a working solution in seconds, invisible to the proctor.
Companies that ask "Minimum Area Rectangle II"
Minimum Area Rectangle II is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share.
Get StealthCoderThe naive instinct is to check all possible rectangles by iterating four points and testing if they form a valid rectangle. That's correct in spirit but slow without a key insight: fix two points as one diagonal of the rectangle, compute the center and half-diagonals, then derive the other two corners and verify they exist in your point set. This collapses the search space. Another approach: for each pair of points, treat them as one side of the rectangle, then calculate where the other two corners must be geometrically. Common failures include floating-point precision errors, missing the constraint that opposite sides of a rectangle are parallel and equal, and overthinking rotation. The Array and Math foundations matter because you're sorting, searching, and applying distance and midpoint formulas. When you're under live OA pressure and the geometry isn't clicking, StealthCoder runs invisibly and gives you the implementation.
Pattern tags
You know the problem.
Make sure you actually pass it.
Minimum Area Rectangle II recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Minimum Area Rectangle II interview FAQ
Is this really a medium problem?+
Acceptance rate is 55 percent, so slightly worse than standard medium. The difficulty ceiling is mid because the geometry concept is learnable, but the implementation details and precision handling trip people up fast. Most who solve it quickly have seen similar geometric constraint problems before.
Do I need to handle rotated rectangles?+
Yes. The rectangle can be at any angle, not just horizontal or vertical. That's the entire point of the problem. You cannot assume axis-aligned corners. This rules out simple grid-based approaches and forces you to work in pure coordinate geometry.
What's the main trick?+
Fix a diagonal or a side and derive the remaining corners algebraically. Don't brute-force all four-point combinations. Use midpoint and perpendicularity to compute where corners must land, then check if those points exist in your set. This turns exponential search into polynomial time.
How does this relate to the Array topic?+
You need to store and search points efficiently. HashSet lookup is critical for verifying computed corner coordinates exist in your input. Sorting points by distance or angle can also optimize the search over candidate rectangles.
Does Verily ask this often?+
Verily has reported this problem in interview reports, but we don't have frequency data. It's a signal that they value geometric reasoning and implementation precision, so if you're interviewing there, geometry chops matter.
Want the actual problem statement? View "Minimum Area Rectangle II" on LeetCode →