We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
这里关于键值对的说法是不是都有点问题? key用来存放下标,而value才用来存放元素(值)吧??
The text was updated successfully, but these errors were encountered:
这样两个key相加等于target的情况下可以直接索引到下标位置,要是key存下标和数组有什么区别,这样怎么优化
Sorry, something went wrong.
这样两个key相加等于target的情况下可以直接索引到下标位置,要是key存下标和数组有什么区别,这样怎么优化 因为查找所用的find()函数在以键值对为元素的容器中,只能查询特定键值(即key)是否出现,所以key不能用来存放下标 若实在想利用数组并通过key存下标,那你应该还得自己想出一个哈希函数,并确保元素映射到的哈希值不太大且均匀分布(不知道你是不是这个意思。。
你要想key存下标对本题算法有什么提升。本题就是想求符合条件的两个元素的下标,使用key存元素、value存下标只需要遍历一遍,使用key存下标你一遍循环能出结果么?
No branches or pull requests
这里关于键值对的说法是不是都有点问题?
key用来存放下标,而value才用来存放元素(值)吧??
The text was updated successfully, but these errors were encountered: