Trains the technique from
LeetCode 836Rectangle OverlapThis 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 plot is given as [x1, y1, x2, y2]: the coordinates of its bottom-left corner followed by those of its top-right corner, with its sides parallel to the axes. Both plots enclose a positive area.
Two plots share ground when the region they have in common encloses a positive area. Merely touching along an edge or at a corner does not count.
Return whether plot1 and plot2 share ground.
Example 1
The second plot sits wholly inside the first, so the region they share is the whole of the second plot.
Example 2
The two plots meet along a horizontal edge but neither reaches into the other, so the region they share is a line with no area.
Example 3
Their horizontal spans do overlap, but the first plot stops at height one and the second starts at height two, so there is no vertical overlap at all.
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 is_rectangle_overlap(plot1: list[int], plot2: list[int]) -> bool:public boolean isRectangleOverlap(int[] plot1, int[] plot2)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.