Find Pair With Given Sum in an Array

Given an array of integers and a value, determine if there are any two integers in the array whose sum is equal to the given value.

Statement

We’re given an array of integers and a value. Determine if there are any two integers in the array whose sum is equal to the given value. Return true if the sum exists; otherwise, return false.

Example

Consider this array and the target sums:

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.