Choose points from two ranges such that no point lies in both the ranges | C ++ implementation of the approach ; Function to find the required points ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void findPoints ( int l1 , int r1 , int l2 , int r2 ) { int x = ( l1 != l2 ) ? min ( l1 , l2 ) : -1 ; int y = ( r1 != r2 ) ? max ( r1 , r2 ) : -1 ; cout << x << " ▁ " << y ; } int main ( ) { int l1 = 5 , r1 = 10 , l2 = 1 , r2 = 7 ; findPoints ( l1 , r1 , l2 , r2 ) ; }