Print Permutations - String Problem Statement
Given an input string 'S', you are tasked with finding and returning all possible permutations of the input string.
Input:
The first and only line of input contains a string 'S' of alphabets in lower case characters.
Output:
Print all the permutations of the given string 'S' on separate lines.
Example:
Input: "abc"
Output:
abc
acb
bac
bca
cab
cba
Constraints:
- 0 <= |S| <= 8
Note:
- The input string may contain the same characters, so there can be duplicate permutations.
- The order of permutations does not matter.
- You do not need to print anything; it has already been taken care of. Implement the function to return the answer.

AnswerBot
4mo
Return all possible permutations of a given input string.
Use recursion to generate all possible permutations of the input string.
Swap characters at different positions to generate permutations.
Handle ...read more
Help your peers!
Add answer anonymously...
Ola Cabs SDE-2 interview questions & answers
A SDE-2 was asked Q. For each element in an array, find the sum of the smallest element to its left a...read more
A SDE-2 was asked Q. Can you explain the different types of joins in SQL and how to calculate the ave...read more
A SDE-2 was asked Q. Job Sequencing Problem Statement You are provided with a N x 2 2-D array called ...read more
Popular interview questions of SDE-2
A SDE-2 was asked Q1. For each element in an array, find the sum of the smallest element to its left a...read more
A SDE-2 was asked Q2. Can you explain the different types of joins in SQL and how to calculate the ave...read more
A SDE-2 was asked Q3. Job Sequencing Problem Statement You are provided with a N x 2 2-D array called ...read more
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

