Problem Submissions Solution

3 Sum

Difficulty: Medium

Acceptance: %

Points: 30.00

You are given an array arr[] and an integer target, determine if there exists a triplet in the array whose sum equals the given target.

Return true if such a triplet exists, otherwise, return false.

Topics

Companies

Articles

Examples:

Expected Time Complexity: O(n^2)

Expected Space Complexity: O(1)

Constraints:
  • 3 <= arr.size() <= 10^3
  • 1 <= arr[i] <= 10^5
Companies:
Microsoft Apple Samsung Visa
Topics:
Array Sorting Algorithm
Locked Content
Access Restricted: Please Login to access the code editor and test cases.