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]
Solution Stats
Problem Comments
4 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers40
Suggested Problems
-
1910 Solvers
-
Piecewise linear interpolation
614 Solvers
-
305 Solvers
-
Implement a bubble sort technique and output the number of swaps required
381 Solvers
-
Check that number is whole number
5188 Solvers
More from this Author54
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
I fixed the test suite, which had a problem described by Alfonso below.
Please use isempty() rather than comparing to [] using isequal().
Test suite has been updated to use isempty() to check for [ ].
As always, thanks, Dyuman!