# Given an array A[] and a number x, check for pair in A[] with sum as x1 min read

How can I solve this problem, Can you please me suggest some algorithms to solve this problem?

I came to know that hashing solution of this problem can also be used to solve similar problem in tree also.

Kapil Bansal Answered question

Start iterating over the array, for each element check whether the sum-element is available in array or not.

For eg,if the array is 1,3,5,8,10

We want to find the sum as 11

Now 11-1=10 is available in the array.Similarly 11-3=8 is also available in array

Kapil Bansal Answered question