The code for CountSort is as shown and I used same method which have to be used in count sort but still im getting all test case with runtime error and wrong answers

The code for CountSort is as shown and I used same method which have to be used in count sort but still im getting all test case with runtime error and wrong answers.


please tell where I’m wrong

your output array creating got too clumsy which was creating problem for the larger test cases
use this simplifed way. added comments for easier understanding


Hope this helps :slight_smile:

mam why they have used char array we have to take input as integer mam?

mam please help according to reply shown

you can read it in any way(char arr or int arr) according to the whatever makes your solution easier. theres no such rule