BackeasyArrays Cognizant

Pair Sum Problem Solution

Problem Statement

Given an array of integers, find all pairs of integers that sum up to a target value.

Example 1
Input
[1, 2, 3, 4, 5] 7
Output
[2, 5], [3, 4]
Example 2
Input
[1, 2, 3, 4, 5] 8
Output
[]
Example 3
Input
[2, 5, 8, 12]
Output
[2, 6], [3, 5], [4, 4], [5, 3], [8, 4], [12, 2]

Constraints

  • 1 <= nums.length <= 1000
  • -1000 <= nums[i] <= 1000
  • 1 <= target <= 2000
Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free