Given eight integers **A, B, C, D, E, F, G and H** which represent two rectangles in a **2D plane.**

For the first rectangle it’s bottom left corner is (A, B) and top right corner is (C, D) and

for the second rectangle it’s bottom left corner is (E, F) and top right corner is (G, H).

Find and return whether the two rectangles overlap or not.

**Input Format**

```
The eight arguments given are the integers A, B, C, D, E, F, G and H.
```

**Output Format**

```
Return 1 if the two rectangles overlap else return 0.
```

**Constraints**

```
-10000 <= A < C <= 10000
-10000 <= B < D <= 10000
-10000 <= E < G <= 10000
-10000 <= F < H <= 10000
```

**For Example**

```
Input 1:
A = 0 B = 0
C = 4 D = 4
E = 2 F = 2
G = 6 H = 6
Output 1:
1
Input 2:
A = 0 B = 0
C = 4 D = 4
E = 2 F = 2
G = 3 H = 3
Output 2:
1
```

NOTE:You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.

Sign Up

to access hints and editorial solutions for**Find if two rectangles overlap**

to access hints and editorial solutions for

Loading...