Naive solution to find if there is a pair in A [ 0. . N - 1 ] with given sum .
#include <bits/stdc++.h> NEW_LINE using namespace std ; bool isPairSum ( int A [ ] , int N , int X ) { for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) {