Hello,

I have query in below question/problem.

https://www.codechef.com/problems/QSET

Here @akumar3 has posted a solution.

Here is the solution link.

https://www.codechef.com/viewsolution/5863202

For that solution I am not able to understand below line.

```
Node mergeNodes(Node left, Node right) {
Node res;
res.sum = (left.sum + right.sum) % 3;
for (int i = 0; i < 3; i++) {
res.remainder[i] += left.remainder[i];
res.remainder[(i + left.sum) % 3] += right.remainder[i];
}
return res;
}
```

I know we are combining nodes here. Let me explain you in example.

Let say we have a string “12”

So we are counting prefixes here.

for 1 = remainder = [0,1,0]

for 12 = remainder = [1,0,0]

Final remainder = [1,1,0]

But when we take separate 1, then remainder = [0,1,0] and for separate 2, then remainder = [0,0,1]. So how can we combine both of these array to get

**remainder = [1,1,0]**. What we are doing inside the loop?

I know the answer we are getting here. But I am not able to understand how we are getting the answer?

Can anybody please explain this code?