我有两个整数数组。我需要找出两个数字,每个数组中一个,其总和等于 2。这在 O(n^2) 中非常简单,但是有没有办法更快呢?
algorithm big-o loops
algorithm ×1
big-o ×1
loops ×1