Marks :10
: 2 | : 1
Given an array $$$X$$$, partition it into two subsets $$$A$$$ and $$$B$$$, such that the following conditions hold :
Please note that $$$A$$$ and $$$B$$$ can have multiple occurrences of the same integer.
Out of all such possibilities of $$$A$$$, output the one which has the least sum, and print the one which is lexicographically maximum out of them in sorted order.
First line contains N - the number of elements in $$$X$$$ (1 <= N <= 1000)
Second line contains N space separated integers, $$$X_{i}$$$ (1 <= $$$X_{i}$$$ <= 1000)
Sum of all $$$X_{i}$$$ <=1000.
Output the elements belonging in set $$$A$$$, in sorted order
5 3 7 5 6 2
5 7
20 2 3 4 4 5 9 7 8 6 10 4 5 10 10 8 4 6 4 10 1
6 6 9 10 10 10 10
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.