Not getting correct answer
hello @mohammadabdullahjawwad
the link is not accessible to me ,
pls use cb ide for code sharing,
and share the problem link as well
Please help
I used the same approach as discussed in the video
see the logic is correct ,but the algorithm is range dependent.
for this problem number can be upto -10^10 to 10^10.
in this case ur code will take O(2*10^10) which is too much time and hence it will give tle.
refer the sorting approach given there in solution
But does it really make a difference O(n) and O(2n)
yeah it will.
in 1 second we can perform only 10^8 operations.
and urs will take roughly 100 sec which is too much time for any cpu .