Tenth question in the quiz

how to know when the loop will stop.since nextpermutation function again gives abc when reached the highest permutation in lexicographic order?

@Rj.25 I don’t know the exact quiz question. But next_permuation() returns false if the array/string is in decreasing order and it changes the order to increasing.

“true if the function could rearrange the object as a lexicographicaly greater permutation.
Otherwise, the function returns false to indicate that the arrangement is not greater than the previous, but the lowest possible (sorted in ascending order).”
src : http://www.cplusplus.com/reference/algorithm/next_permutation/

does when the function returns false,it also reaaranges the array into lower no.?