Core dumped ? why?

@gagz23 I think you shared the wrong code

4
1 1 1 1
2
Ans is 1 and 1
Check for it

yes sir that the issue the pairs are repeating … how to find unique pairss.

@gagz23 think of two pointer approach for that