Bigger is Greater Time : O(1) Space : O(1) 12345string biggerIsGreater(string w) { string res = w; next_permutation(begin(res), end(res)); return res > w ? res : "no answer";}