Algorithm · Disney · Medium
This question is a sequence of three connected array tasks. Part 1: You are given an integer array that is not sorted, along with a target value. Locate two elements of the array whose sum equals target. Part 2: Solve the same pair-finding task, but this time the input array is already in sorted order. Locate two elements whose sum equals target. Part 3: Given an integer array, return every distinct triplet of elements whose sum is zero. No triplet may appear more than once…