Identifying the hidden constraints

How should approach the solution so as to cover all the constraints?
For example, in this code I am not able to identify the violation that my code may not be taking care of.

hey Reshma, it can be done with simple brute force approach in which you run 2 for loop(i: 0 to n, j:
i to n) in O(n^2).
the only constraint that you should take care is to print smaller number of the pair first and than larger number of the pair after finding the pair that sums to target.

Example: target =5 and arr[]={1,3,4,2,5} than output should be 1 and 4
2 and 3

As far as I have understood, I think I have adopted the same approach and even sorted the result to obtain the required output, but I have not been able to pass the test case4.

hey reshma, please save your code in coding blocks ide and share it here

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.