MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / allPairs

Method allPairs

CPP/findSum.cpp:6–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4class Solution{
5 public:
6 vector<pair<int,int>> allPairs(int A[], int B[], int N, int M, int X)
7 {
8 vector<pair<int,int>>v;
9 for(int i =0;i<N;i++){
10 for(int j =0;j<M;j++){
11 if(A[i]+B[j]==X){
12 v.push_back({A[i],B[j]});
13 }
14 }
15 }
16 sort(v.begin(),v.end());
17 return v;
18 }
19};
20
21

Callers 1

mainFunction · 0.80

Calls 1

push_backMethod · 0.80

Tested by

no test coverage detected