[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

Program Discussion :: Basics

Home > Programs > Basics

102 / 279

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

Answer:

#include 

#include
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:

Language:

Post Your Reply Here:



Language:

Post Your Reply Here: