题目链接
https://leetcode.com/problems/two-sum/description/

解1:暴力遍历法

解2:哈希表法
将值作为key存到字典中,两次遍历,复杂度2n
注意字典中是否有每个数的判断方法:是判断key是否在字典中


题目链接
https://leetcode.com/problems/two-sum/description/
解1:暴力遍历法
解2:哈希表法
将值作为key存到字典中,两次遍历,复杂度2n
注意字典中是否有每个数的判断方法:是判断key是否在字典中
本文标题:【数组】two sum
本文链接:https://www.haomeiwen.com/subject/fiidmftx.html
网友评论