Problem 1074. Property dispute!
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
Show
1 older comment
Ned Gulley
on 2 Jan 2013
I fixed the test suite, which had a problem described by Alfonso below.
Christian Schröder
on 9 Jun 2024
Please use isempty() rather than comparing to [] using isequal().
Dyuman Joshi
on 11 Jun 2024
Test suite has been updated to use isempty() to check for [ ].
Christian Schröder
on 11 Jun 2024
As always, thanks, Dyuman!
Solution Comments
Show commentsProblem Recent Solvers38
Suggested Problems
-
3837 Solvers
-
Find state names that end with the letter A
1175 Solvers
-
Flag largest magnitude swings as they occur
678 Solvers
-
Sum of odd numbers in a matrix
574 Solvers
-
Write a function man that takes a row vector v and returns a matrix H as follows..
615 Solvers
More from this Author50
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!