Skip to content

Latest commit

 

History

History
10 lines (7 loc) · 323 Bytes

README.md

File metadata and controls

10 lines (7 loc) · 323 Bytes

Idea

The idea to solve this problem is quite simple, we need to output a pair of a, b such that a + b = target. So we just build a hash table (dictionary) to save all the nums and their index we have seen so far, which to be said:

dic[num] = idx

when target - b is in dic, then we just return the index