Friday, March 1, 2019

Finding All Permutations of a given String

Problem: Find all permutations of a given string and display them in lexicographically increasing order.

GFG Link:

GFG Practice Link:

My Solution:

1. Use recursion to get the strings.
2. Use a TreeMap to get order.


Time Complexity:
O(n * n!) not considering the time for lexicographical sort.

No comments:

Post a Comment