Find the two sum
EasyGiven an array of integers and a target number, write a function that determines if there are two numbers that add up to the target number.
For example, given the following inputs:
numbers = [5, 1, 3, 9]target = 4
Your function should return
True
since two elements in the input array, 1
and 3
, add up to the target 4
.Try it first
Solution
6 Essential Hash Tables Coding Interview Problems
Master Hash Tables by trying the coding challenges below.
- 1.Two sumEasy
- 2.Palindrome CheckEasy
- 3.Cover SetMedium
- 4.Missing numberMedium
- 5.Crypto ExchangeMedium
- 6.Distinct SubarrayHard