Problem in approach of counting sort

TESTCASE # 1 : wrong-answer (Time: 0.09 s)
I am getting this as output, meanwhile, the answer I am getting is correct while trying sample input.

@Adarsh25trivedi Note the constraints given in the question.
Constraints
1<=N<=10^6 0<=Ai<=10^6
But you are restricting the size of array to 50. So your code will not work when number of inputs given is grater than 50. Increase the size of your array to 10^6 and then check.

Hope this helps :slightly_smiling_face:

sorry I forgot to mention, but I have already tried that

@Adarsh25trivedi
Consider a test case:
7
8 6 9 4 3 2 1111

Your Output:
2 3 4 6 8 9

In line 9 you are restricting the size of count array to 256 which is creating the problem.
int count[256] – your 9th line
Now say if arr[i] =1000
count[arr[i]]=count[arr[i]]+1 —> your line 22 will not work.

Hope this helps :slightly_smiling_face: