Question:

Given two axis-aligned rectangles A and B. Write a function to determine if the two rectangles overlap.


http://leetcode.com/2011/05/determine-if-two-rectangles-overlap.html

private static class Rectangle
{
    public Point getLeftUp() {...}
    public Point getRightDown() {...}
}

public void overlap(Rectangle a, Rectangle b)
{
    Point p1 = a.getLeftUp();
    Point p2 = a.getRightDown();
    
    Point p3 = b.getLeftUp();
    Point p4 = b.getRightDown();
    
    boolean notouch = 
        p2.x < p3.x || p4.x < p1.x || p2.y < p3.y || p4.y < p1.y;
    return !notouch;
}