String Permutation Inbuilt STL, is a Backtracking related problem and in this post we will see how we can solve this challenge in C++

//Given a string ,print all its permutations using next_permutation() of STL Works only for string with duplicates also TC: O(n*n-1 + nlogn) next_permutation() takes O(n) :it finds and modifies the next lexographically larger string else if not possible then returns false we sort the string in incresing order so that it is lexographically smallest then apply next_permutation till possible

Please check the main.cpp snippet for the solution.

This solution originally posted at: Github by @susantabiswas