Have you heard of Heap's algorithm

I recently encountered a problem on HackerRank named “Bigger is Greater”: https://www.hackerrank.com/challenges/bigger-is-greater/problem . The problem statement is as follows: given a string, the solution program needs to find the smallest of all the string permutations which is bigger than the string itself. In case no solution that match the criterias is found, no answer is to be returned.…