Hi, I have a problem and can't get a solve for it.
So this is a problem :
Input: array ordered in growed order and number S
Output: are there two numbers in an array that their sum is equal to S.
The simple way to solve it is by two loops, but in this case program will make about n^2 operation. My task is to solve this problem in n operations.
So if there anybody that can do that please help me...
So this is a problem :
Input: array ordered in growed order and number S
Output: are there two numbers in an array that their sum is equal to S.
The simple way to solve it is by two loops, but in this case program will make about n^2 operation. My task is to solve this problem in n operations.
So if there anybody that can do that please help me...