We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
In your first while loop you are using condition i>=0, which results in i=-1 if its already sorted string. So your next condition becomes s[-1]<=s[0] which is resulting in segementation fault.
Bigger is Greater
You are viewing a single comment's thread. Return to all comments →
In your first while loop you are using condition i>=0, which results in i=-1 if its already sorted string. So your next condition becomes s[-1]<=s[0] which is resulting in segementation fault.