Arrays & Hashing • Easy

Two Sum

Given an array of integers `nums` and an integer `target`, return indices of the two numbers such that they add up to `target`.

The Challenge

Given an array of integers `nums` and an integer `target`, return indices of the two numbers such that they add up to `target`.

Difficulty Easy
Topic Arrays & Hashing

Pro-tip: Use a Dictionary to store the complement of each number as you iterate through the array.

Solution.swift Tests.swift
Output
Ready to run.