2.4 Consider the problem M3SUM, which is defined as follows.
Problem 2.6: M3SUM
Instance: Question: An array of n distinct positive integers,
A = [A[1], . . . , A[n]].
Do there exist three array elements A[i], A[j] and A[k] such that
A[i] + A[j] = A[k],
where 1 ≤i, j, k ≤n and i, j, k are all distinct?
Define
B[ℓ] = 4A[ℓ]−1
for 1 ≤ℓ ≤n and define
B[ℓ + n] =−4A[ℓ] + 2
for 1 ≤ℓ ≤n. Show that solving 3SUM on the array B (of length 2n) will
solve M3SUM on the array A (so this is a many-one reduction from M3SUM
to 3SUM)