Files
dsa-competitive-programming/leetcode/two-sum/notes.md
T
2025-12-06 10:00:23 +00:00

446 B
Raw Blame History

One pass: one pass starts from index 0 and stores it in a map, and for next number in array, it computes the new complement and checks if its present in map, if yes then prints else stores the original number in hash and continues

Two pass: Two-pass hash table solution first builds a map of all values to their indices, then makes a second scan through the array to compute each elements complement and check if it exists in the map.