[leetcode][1]Two Sum
2021-01-28 11:34:55 0 举报
两种算法完成两数之和
作者其他创作
大纲/内容
j loop
EXIT
j++
for i loop
i loop
i+j = t
i++
exit
N
Y
n
y
the O(n) way
the O(n2) way
init a hashmap
if target - nums[i] in hashmap
hmap[target-sums[i]] = i

收藏
![[leetcode][1]Two Sum](https://www.processon.com/chart_image/template/thumb/601152795653bb05f941f8ea.png?tid=601152795653bb05f941f8e8)
收藏
0 条评论
下一页