Write a Python function that takes a string input and returns all possible combinations of characters in that string, excluding combinations with repeated letters. For example, if the input is 'abc', the outputs should include 'acb', 'cab', 'bca', etc., but not 'aab', 'bcc', 'abb', etc.

AnswerBot
1y

This function takes a string input and returns all possible combinations of characters in that string without repeated letters.

  • Use the itertools module to generate all possible permutations of the str...read more

Anonymous
author
3y

def permutations(remaining, candidate=''):

if len(remaining) == 0:

print(candidate)

for i in range(len(remaining)):

newCandidate = candidate + remaining[i]

newRemaining = remaining[0:i] + remai...read more

Help your peers!
Select
Add answer anonymously...

Popular interview questions of RND Engineer

A RND Engineer was asked Q1. How would you build an airline system to recommend all possible routes from city...read more
A RND Engineer was asked Q2. What is layer normalization in FFNs?
A RND Engineer was asked Q3. Write a Python function that takes a string input and returns all possible combi...read more
Senseforth RND Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
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

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits