Stack Bash - Master data structures and algorithms

Find the two sum

Given 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


6 Essential Hash Tables Coding Interview Problems

Master Hash Tables by trying the coding challenges below.
  1. 1.Two sumEasy
  2. 2.Palindrome CheckEasy
  3. 3.Cover SetMedium
  4. 4.Missing numberMedium
  5. 5.Crypto ExchangeMedium
  6. 6.Distinct SubarrayHard

Want to confidently pass your next coding interview?

Stack Bash helps new and veteran software engineers master data structures and algorithms for technical interviews.