Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Problem 1074. Property dispute!

Created by Ned Gulley

Two neighbors have rectangular plots of land A and B. The surveyors give you the coordinates of each. If they overlap, there is a property dispute, and you must return the coordinates of the disputed region. If there is no conflict, return the empty set [].

Suppose A and B look like this.

 *--------*
 | A      |
 |    *--------*
 |    |   |    |
 |    |   | B  |
 |    |   |    |
 |    *--------*
 |        |
 *--------*

We will give rectangle coordinates in [xLow yLow width height] format. So

 A = [0  0  5 10]
 B = [3  2  6  6]

Then you should return rectangle that corresponds to the overlapping region.

 C = [3  2  2  6]

Tags

Problem Group

Solution Statistics

13 correct solutions 36 incorrect solutions
Last solution submitted on Nov 27, 2014

Problem Comments

Solution Comments