Project Team
Practice
3.2 (16 votes)
Easy
Problem
28% Success 12713 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

A Professor of Physics gave projects to the students of his class. The students have to form a team of two for doing the project. The professor left the students to decide the teams. The number of students in a class will be even.

Each student has a knowledge level. It tells how much knowledge each student has. The knowledge level of a team is the sum of the knowledge levels of both the students.

The students decide to form groups such that the difference between the team with highest knowledge and the one with lowest knowledge is minimum.

Input

First line of the input will contain number of test cases t; In the next t lines the first number is n the number of students in the class followed by n integers denoting the knowledge levels of the n students

Output

Your output should be a single line containing the lowest possible difference between the team with highest knowledge and the one with lowest knowledge.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
245 votes
Tags:
Easy
Points:20
173 votes
Tags:
Ad-HocSorting algorithmOpenApprovedEasy
Points:20
2 votes
Tags:
ImplementationSortingEasyEasy