Problem

Return true if some pair of distinct indices has elements that add up to target (same element twice is not allowed).

Examples

  • hasPairSum([2, 7, 11, 15], 9) -> true
  • hasPairSum([3, 2, 4], 6) -> true
  • hasPairSum([3, 3], 6) -> false
Compile and test (Ctrl+Enter)