Top 100 Liked Questions (1)

Top 100 Liked Questions (1)

1. Two Sum

题目描述

若直接穷举遍历时间复杂度为O(n2)O(n^2),考虑使用O(n)O(n)空间换时间,用hashmap将array的value存储为key,value值为index,hashmap查找时间复杂度为O(1)O(1)​

Author: NYY
Link: http://yoursite.com/2019/01/22/leetCode/leetcode0122/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.