Given an array of integers, create pairs of them, such that every created pair has the same
Fantastic news! We've Found the answer you've been seeking!
Question:
Given an array of integers, create pairs of them, such that every created pair has the same sum. This sum is not specified, but the number of created pairs should be the maximum possible. Each array element may belong to one pair only. Write a function: class Solution { public int solution(int[] A); } that, given an array A consisting of N integers, returns the maximum possible number of pairs with the same sum. I need a timely answer please. I need solution in nlogn. It was asked in my interview?
Related Book For
An Introduction To Statistical Methods And Data Analysis
ISBN: 9781305465527
7th Edition
Authors: R. Lyman Ott, Micheal T. Longnecker
Posted Date: