Forgot Password ?
New password will be sent to following email id
Find the subsets
Problem Code : MINSUB
2 5 1 2 3 4 5 3 5 2 1
Time Limit :
C , C++ , Java , Python 2
Login to submit your response.
Didi's friends always complain that Didi brings Kachoris for Appu's friends only. So this time Didi decides to distribute Kachoris in two sets, one for Appu's friends and one for her friends. Didi brought <b>N</b> boxes of Kachori from home this time. The <b>i<sup>th</sup></b> box contains <b>A<sub>i</sub></b> number of Kachoris. All that remains is to distribute the Kachoris in two sets. But there is a problem, she has to distribute the boxes in two sets such that the absolute difference between the number of Kachoris in each set is minimised. <br><br> <b>Note</b> - <br> A box cannot be opened by Didi so all the kachoris in a particular box goes to only one set.
First line contains an integer <b>T</b> denoting the number of test cases.<br> First line of each test case contains an integer <b>N</b> denoting the number of boxes.<br> Next line contains <b>N</b> integer, <b>A<sub>i</sub></b> denoting the number of Kachoris in each box.
Print the minimum difference possible for each test cases.<br>
1 ≤ <b>T</b> ≤ 5 <br> 1 ≤ <b>N</b> ≤ 20<br> 1 ≤ <b>A<sub>i</sub></b> ≤ 1000000