I tried using the three loops method in the question but it doesnt display the solution in order

i checked the question on other sites, they show we have to use hashtable and string but i don’t know how to solve it
please explain the whole code with basic use of variables so that i can understand i don’t know a lot of topics and they haven’t been studied in these tutorials

@aryapandey194_31bab11b21ee53fb
the main logic is when you have 2 numbers and a given sum like
a and b are the known numbers and sum is the sum the
a + b + unknown_number = sum
then
unknown_number = sum - a -b
and we can store frequencey each number previously so instead using a complete for loop for finding the third number we can just find it in O(1) instead of O(n) that reduces the overall time complexity to O(n2)
if you still have any issue feel free to ask and if clear please mark it as solved and rate my experience

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.

can you check what is wrong with my code?

this is the link to my code it shows tle to one of the test cases https://ide.codingblocks.com/s/615312

your code time complexity is very high
O(n^3)

you are using worst sorting technique having time complexity = O(n^2)

that’s why you got tle
try to do this using 2 pointer approach and 1 loop
also use inbuilt sort or merge sort/quickSort

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.