时间复杂度和补码有什么关系?

What's the relationship between time complexity and complement?

时间复杂度和补码有什么关系?

不明白补码是什么意思

我不明白下面的句子。

Approach #2 (Two-pass Hash Table) [Accepted]

To improve our run time complexity, we need a more efficient way to check if the complement exists in the array. If the complement exists, we need to look up its index. What is the best way to maintain a mapping of each element in the array to its index? A hash table.

https://leetcode.com/problems/two-sum/solution/

Complement 指的是添加到当前数字后将为您提供 target.

的值的其他数字

如果(对于所有)a + b = target,那么a的补数是b.

为了查看一个数的补码是否存在,而不是循环遍历数组(即O(n )), 他们正在存储它(源数组中的元素)是一个散列映射。