2dbi
Home/Vercel/Two Sum / Hash Table
VVercel·DSAEngineerTechnical Phone Screen

Two Sum / Hash Table

Problem

Return indices of two numbers summing to a target (Vercel emphasizes arrays + hash tables).

Example

[2,7,11,15], 9 -> [0,1]

Constraints

  • 2 ≤ n ≤ 10^4

Approach

Hash map, O(n).

added 6 days ago
LeadersAccount