Recursive function for generating all permutations of an input string — InterviewCake

Abrar Shariar
2 min readAug 26, 2020

The problem is borrowed from InterviewCake. Although they did a great job explaining the solution in detail, there aren’t that many visuals.

This post is my attempt to visualize the solution:

Sample I/O

Input: ‘cat’

output: {‘cat’, ‘atc’, ‘act’, ‘tca’, ‘tac’, ‘cta’}

The Pattern:

Abrar Shariar

Techie | Engineer | Coder