What's the error?

not even a single testcase got correct answer please review my code. Where did it go wrong?

Please send the link to your code

code is in my submissions so from where m i suppose to send you the link?

And Chat with TA option is not working


Copy paste your code in this link. Save it and send the link.

whats the point in generating a link every time I want to ask a doubt?
And chat with TA option is not working?
neither can I see your replies in my course doubt section

Well this is how it works. We can’t see your submitted codes.
Yes I don’t know what’s wrong with that option.
Is your doubt resolved now?

what’s the logical error in my code as its giving wrong answer to testcases but sample testcase is working fine

Your code might be missing out some cases.
Do one simple thing -
First sort the array and then it can be done using two nested loops.
Try to figure out the conditions.

i’hv sorted it nd used nested loops also

In line 26, the k loop should start from m-1 and not m as the m index is invalid.

m is n-1 so its valid

So your i and j loops should run till they are equal to m

And in your k loop, you are updating the value of m if the condition is true

yes… is that wrong?

Your test condition of the for loops are changing again and again. So yes its wrong.


i modified it still its giving wrong answer

There is no need to update the value of m anywhere


Check my code and tell me if you are able to understand it.
I have just sorted the array and used 3 nested loops