- 0
Notifications Mark All Read
- Login
- Get Prime
Question 1
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
Python
Python
A, B, C, D, E, F, G, H = map(int, input().split()) if (A >= G) or (E >= C): print("0") #No_overlapping else: print("1") #Overlapping
Output
2 3 4 5 1 2 6 4
1
Login/Signup to comment