C++ Coding Reference: next_permutation() and prev_permutation()
C++ algorithm header provides you access to next_permutation() and prev_permutation() which can be used to obtain the next or previous lexicographically order. With an array or vector or string …