MEDIUMasked at 1 company

Rectangles Area

A medium-tier problem at 69% community acceptance, tagged with Database. Reported in interviews at X and 0 others.

Founder's read

You're staring at a database problem where you need to calculate rectangle areas from a table of coordinates. X has asked this, and it's Medium difficulty, but the catch is that SQL isn't always intuitive when you're computing geometry on the fly. The acceptance rate sits around 69%, which means a decent chunk of candidates miss the setup or the join logic. If you haven't worked with self-joins or coordinate arithmetic in SQL recently, this is the kind of problem that can stall you during the assessment. StealthCoder handles it in seconds if you blank on the query structure.

Companies asking
1
Difficulty
MEDIUM
Acceptance
69%

Companies that ask "Rectangles Area"

If this hits your live OA

Rectangles Area 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. Made by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know.

Get StealthCoder
What this means

The core trick here is recognizing that you probably have a table with coordinates, and you need to pair them correctly to form rectangles, then compute area. Most candidates either botch the join condition (pairing points that don't form valid rectangles) or forget that area requires absolute value when coordinates might be negative or unordered. The obvious approach of joining every point to every other point creates a huge dataset, and then filtering becomes messy. The right path is usually a self-join with specific constraints on coordinate relationships, then multiplying width by height. Database-specific syntax matters too. If you hit this live and the join logic isn't clicking, StealthCoder surfaces the correct query structure immediately, invisible to the proctor.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Rectangles Area 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. Made by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Rectangles Area interview FAQ

Is this really a Medium, or does it feel harder?+

The acceptance rate of 69% suggests it's appropriately calibrated. The difficulty comes from the join logic and coordinate pairing, not advanced SQL. Once you see the pattern, it's straightforward arithmetic. Most people get tripped up on the setup, not the math.

Do I need to know advanced SQL functions for this?+

No. You need self-joins, basic arithmetic (multiplication, absolute value), and filtering. The problem tests your ability to think about data relationships, not SQL library knowledge. Stick to core operations and you're fine.

What's the most common mistake candidates make?+

Incorrect pairing of coordinates. You can't just join every row to every row and hope to filter later. You need to understand which points form a valid rectangle before computing area. Sloppy join conditions blow up the result set.

Will X ask follow-ups about performance or indexing?+

Possibly, but only if you solve it correctly first. Once your query returns the right answer, you can discuss indexing on coordinate columns or optimizing the join. But get the logic right before worrying about scale.

How does this relate to the Database topic?+

It's a pure SQL problem that tests your understanding of relational logic, self-joins, and coordinate geometry applied to tables. You're not writing application code; you're thinking in sets and relationships, which is the core of database design.

Want the actual problem statement? View "Rectangles Area" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.