2dbi
Home/Tesla/Two Sum
TTesla·DSASDE-1Online Assessment

Two Sum

Problem

Return indices of the two numbers in nums that add up to target.

Example

nums = [3,2,4], target = 6
Output: [1,2]

Constraints

  • 2 ≤ nums.length ≤ 10^4

Expected

O(n) hash map. Tesla OA is timed (3 problems in ~85 min) — speed matters.

added 6 days ago
LeadersAccount