Problem Submissions Solution

2Sum - Pair With Given Sum

Difficulty: Easy

Acceptance: %

Points: 20.00

Given an array arr of positive integers and another number target. Determine whether two elements exist in arr whose sum is exactly target or not. Return true if two elements exist in the arr else return false.

Topics

Companies

Articles

Examples:

Expected Time Complexity O(n)

Expected Space Complexity O(n)

Constraints:
  • 1 <= arr.size <= 10^5
  • 1 <= arr[i] <= 10^5
Companies:
Amazon Microsoft Adobe Google TCS + 5 more
Topics:
Array Hashing Hashmap
Locked Content
Access Restricted: Please Login to access the code editor and test cases.