You are viewing a single comment's thread. Return to all comments →
I did exactly the same. And it works but, its complex. my version is even more complex. you actually dont need double for loop.
for (int j = len - 2; j >= 0; --j) { if (chars[j] < chars[j + 1]) { ind = j; break; } }
Then swap and sort.
Seems like cookies are disabled on this browser, please enable them to open this website
Bigger is Greater
You are viewing a single comment's thread. Return to all comments →
I did exactly the same. And it works but, its complex. my version is even more complex. you actually dont need double for loop.
Then swap and sort.