Here is my solution for TACHSTCK problem: http://www.codechef.com/viewsolution/3816885

Can anyone help me out why I get sigsegv?

Thanks a lot!

Here is my solution for TACHSTCK problem: http://www.codechef.com/viewsolution/3816885

Can anyone help me out why I get sigsegv?

Thanks a lot!

This is the Accepted version of your code. I just changed the condition of the “for” loop from i!=n-1 to i < n-1. You are comparing l[i] with l[i+1] and the values in the array are stored till index n-1, therefore the correct condition is i < n-1.

1 Like

So true…

Thanks a lot for this. Works like a charm now :).