Rectangle Overlap
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
An axis-aligned rectangle is given as [x1, y1, x2, y2], where (x1, y1) is its bottom-left corner and (x2, y2) its top-right corner, with x1 < x2 and y1 < y2.
Given two such rectangles rec1 and rec2, return true if their intersection has **positive area**, and false otherwise. Rectangles that only touch along an edge or at a corner do not overlap.
Examples
Constraints
- rec1.length == rec2.length == 4
- -10^9 <= rec1[i], rec2[i] <= 10^9
- Each rectangle has `x1 < x2` and `y1 < y2`
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.