1 / 75
E

Two Sum

#1
arrayhashmap

Use a hashmap to store complements and return indices when found.

Example:

Input:[2,7,11,15], target=9
Output:[0,1]

Common Mistakes:

  • Off-by-one indexing
  • Not handling edge cases (null/empty)

Notes:

Edge cases: duplicates, empty inputs, negative numbers where applicable.

1/75
Two Sum
dflo.io - Revise DSA in Minutes