DSA learning series - Contest Code:LRNDSA01 Problem Code:ZCO14003

Hello all,

My solution(https://www.codechef.com/viewsolution/38009717) is not passing 2 test cases for Contest Code:LRNDSA01
Problem Code:ZCO14003

So could you please help me to find where can i optimize still so that 2 test cases can pass.

Use the inbuilt “qsort” function instead of ur Q sort function ,it will be faster.

Your solution using inbuilt qsort gave ac on all tests


Hi @rahulmysuru7,

Thank you very much for your help and suggestions and yes it worked, all test cases are passed using inbuilt qsort() but I was interested to know where to optimize my code without using inbuilt qsort() So that all test case pass.

To begin with, don’t use a sorting algorithm with worst-case O(N^2) complexity when N can be up to 5 \times 10^5 :slight_smile: