Hello everyone, I have solved the question ( CodeChef) and according to me everything is fine in the code but still I am getting the partially correct answer on submission. Can’t figure out the mistake. Kindly help.

My solution- CodeChef

I can explain the main logic which is that you need to find the **smallest and second smallest number** of the given list of numbers. **No need to use the vector** as you were using in the solution and **no need to use long long** as we are not exceeding value of Integer in any case.

for each case run the while(t–) and for the n numbers inside the **for loop** you read the number and make the following comparison: *java code*

```
for(int i = 0; i < size; i++){
int val = sc.nextInt();
if(val < smallest){
small = smallest;
smallest = val;
} else if(val != smallest && val < small){
small = val;
}
}
```

Initial value of small and smallest is `1000000`

as per the constraints and now you can return the sum of small and smallest.

If you don’t understand the logic just google how to find the smallest and second smallest numbers in a list.

my solution - Solution