算法找到对数字的整数数组whoes总和相等
算法找到对数字的整数数组whoes总和是相等的。 前{1 2 3 4 6}
Algorithm to find the pair of numbers in an integer array whoes sum are equal. ex {1 2 3 4 6}
此处{3 2} {4 1}应的输出,因为总和是3 + 2 = 5,4 + 1 = 5。
here{3 2} { 4 1} should be the output, because the sum is 3+2=5, 4+1=5.
在这里,主要的是复杂SHLD是为O(n)。请帮我,如果我们发现这个任何的解决方案?
Here the main thing is the complexity shld be O(n). Please help me if we find any solutions for this?
你确定这个问题是可以解决的,在所有的O(N)?
Are you sure that the problem is solvable at all in O(n)?
想象的情况下,当输入序列是仅有{0,0,0,0,0,0,...,0}。这里每两个双满足该条件。刚刚上市的所有对已至少为O(n ^ 2)。
Imagine the case when the input sequence is just {0, 0, 0, 0, 0, 0, ..., 0}. Here every two pairs satisfy the condition. Just listing all the pairs is already at least O(n^2).