Name Reduction | Run time Error

Here is my code: http://www.codechef.com/viewsolution/2167540 , it is giving run time error, I have banged my head for several hours, but couldn’t find why, I tried to do it with different array sizes (even 200000), but still the run time error.
Please help.

@yogeshpoddar : The code that you have given indeed gives runtime error in ideone .
I was able to run it with right output after two changes .

  1. Change this line : a[child[i]]–; TO a[child[i]-97]–;
  2. Remove this line : free(child);
    After this it should lead to correct answer .
    Best of luck . Happy Coding .
    Cheers.
6 Likes

'cause banging head doesn’t get you AC! :stuck_out_tongue:

It is working. Thanx a lot. Cheers! :slight_smile: