ARRAYS-TARGET SUM tripletss

https://hack.codingblocks.com/contests/c/537/215

https://ide.codingblocks.com/s/42776

All my trial inputs are giving correct result. But it is showing “no output” for one testcase.

If I use the built-in sort function then I am passing all the test cases. But I still don’t know what was the problem with my code.

In built Sort function has time complexity O(n logn).
and you are using O(n^2 ) to sort .
So either use merge sort or quick sort or inbuilt sort function cozz these has O(nlog n) complexity.

Time Complexity : O(n logn) is much better than O(n^2)

Hope u get it.
Hit like if u get it

1 Like