Created
April 10, 2019 22:18
-
-
Save vzarytovskii/6a10c1aad35d9ae77c71cf97da47dea1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MAX 100000 | |
void printPairs(int arr[], int arr_size, int sum) | |
{ | |
int i, temp; | |
bool s[MAX] = {0}; | |
for (i = 0; i < arr_size; i++) | |
{ | |
temp = sum - arr[i]; | |
if (temp >= 0 && s[temp] == 1) | |
printf("sum=%d is (%d, %d) n", sum, arr[i], temp); | |
s[arr[i]] = 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment