Sort in linear time

my code is running perfectly fine in IDE but i am not able to pass any test case . please let me know the fault in my code

Hello @rahul.aggarwal000005,

There is a silly mistake in your code.
I have corrected it:


Refer to comments for better understanding.

hope, this would help.
Give a like if you are satisfied.