In this

**HackerEarth [Only for Data Engineering] - Bank Data Consistency Check problem solution**Bank X contains a database of account numbers and debit cards mapped to each other. Now due to some technical issues, the data suddenly got deleted. But now the bank is left with a list of pairs of integers but they don’t know which of them is the debit card no. and which one is the account number.It is clear that an account can have multiple debit cards linked to it, but it is not possible that a debit card is linked to more than one accounts.

You need to check if the given data is recoverable or not. If it is consistent then you need to also find what is the account number and what is the debit card number. It is guaranteed that the input data is designed in a way that there is only one unique correct answer.

If for a pair it is impossible to find, you need to print -1 -1.

## HackerEarth [Only for Data Engineering] - Bank Data Consistency Check problem solution.

#include<bits/stdc++.h> #define LL long long int #define M 1000000007 #define reset(a) memset(a,0,sizeof(a)) #define rep(i,j,k) for(i=j;i<=k;++i) #define per(i,j,k) for(i=j;i>=k;--i) #define print(a,start,end) for(i=start;i<=end;++i) cout<<a[i]; #define endl "\n" LL pow(LL a,LL b,LL m){LL x=1,y=a;while(b > 0){if(b%2 == 1){x=(x*y);if(x>m) x%=m;}y = (y*y);if(y>m) y%=m;b /= 2;}return x%m;} LL gcd(LL a,LL b){if(b==0) return a; else return gcd(b,a%b);} LL gen(LL start,LL end){LL diff = end-start;LL temp = rand()%start;return temp+diff;} using namespace std; int main() { ios_base::sync_with_stdio(0); }

## 0 Comments