what is my code wrong

http://www.codechef.com/viewsolution/5648742

your sorting method is incorrect

here is my code with the coding part same just i changed the sorting method . and got AC

http://www.codechef.com/viewsolution/5648797

1 Like

what @acodebreaker is correct…

I would like to give you a hint for sorting problems

If you are using C as language for coding then you may use inbuilt function named qsort() to sort the array.

You may read about it here

And if you are using C++ then using STL you may use inbuild function sort() to sort the array or vector by including algorithm header file.

You may read about sort() here.

Here is your AC code where i have replaced merge_sort() with qsort() inbuild function.

http://www.codechef.com/viewsolution/5648860