In this quick tutorial, we’ll learn to solve an algorithmic problem of checking whether the two given rectangles overlap.
We’ll start by looking at the problem definition and then progressively build up a solution.
Let’s say we have two given rectangles — r1 and r2. We need to check if there’s at least one common point among r1 and r2. If yes, it simply means that these two rectangles overlap.
Let’s have a look at some examples:
Point.java
Rectangle.java
RectangleOverLapping.java