what if we sort the sum mahesh has provided and print the first N elements after the first element as every time first element will be {} as its subset of array

Consider the following test case :

```
3
0 1 1 2 100 101 101 102
```

Your output : 1 1 2

Correct output : 1 1 100

Hope this helps in clarifying the problem!!

4 Likes

This is not true for example if you take n=4 s.t. a=1,b=2,c=4,d=7 are the required elements then the sorted array will contain 0,1,2,3…and now as you can see that 3 is not the correct answer.

2 Likes