Missing vertex among N axis | C ++ Program to implement the above approach ; Driver Code ; Number of rectangles ; Stores the coordinates ; Insert the coordinates
#include <bits/stdc++.h> NEW_LINE using namespace std ; void MissingPoint ( vector < pair < int , int > > V , int N ) { map < int , int > mp ; for ( int i = 0 ; i < V . size ( ) ; i ++ ) { mp [ V [ i ] . first ] ++ ; } int x , y ; for ( auto it : mp ) { if ( it . second % 2 == 1 ) { x = it . first ; break ; } } mp . clear ( ) ; for ( int i = 0 ; i < V . size ( ) ; i ++ ) { mp [ V [ i ] . second ] ++ ; } for ( auto it : mp ) { if ( it . second % 2 == 1 ) { y = it . first ; break ; } } cout << x << " ▁ " << y ; } int main ( ) { int N = 2 ; vector < pair < int , int > > V ; V . push_back ( { 1 , 1 } ) ; V . push_back ( { 1 , 2 } ) ; V . push_back ( { 4 , 6 } ) ; V . push_back ( { 2 , 1 } ) ; V . push_back ( { 9 , 6 } ) ; V . push_back ( { 9 , 3 } ) ; V . push_back ( { 4 , 3 } ) ; MissingPoint ( V , N ) ; return 0 ; }