Question 1

Hexaware Coding Questions

Question 1

Given eight integers A, B, C, D, E, F , G and H which represents two rectangles in a 2D plane. For the first rectangle it’s a 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 returns whether the two rectangles overlap or not.

Input Format:

  • 8 space separated integers in a single line in the order A, B, C, D, E, F, G and H

Constraints

  •  1 <= A,B,C,D,E,F,G,H <= 10

Output Format

  • A single integer 1 if the two rectangles overlap else return 0

Code for the above Problem