Take FREE!! Online Mettl Mock Test to Crack TechM and Other Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
TCS NQT Technical and Managerial Round Interview Questions

Program Discussion :: Basics

Home > Programs > Basics

3 / 265

Given a sorted array and an item k, write a program to get a pair of items whose subtraction equal to K.



using namespace std;
/* The function assumes that the array is sorted */
bool findPair(int arr[], int size, int n)
    /* Initialize positions of two elements */
    int i = 0;  
    int j = 1;
    /* Search for a pair */
    while (i

Asked In :: Adobe

Post Your Answer Here:


Post Your Reply Here:


Post Your Reply Here: