⚡️ Tryprepforge
Backend Engineer Senior programming

Implement a function that returns all unique permutations of a given string, ensuring that the output is sorted lexicographically. ### Constraints: - Str length from 1 to 8. Each character is a lowercase letter. ### Examples: 1. Input: 'zyx' Output: ['xyz', 'xzy', 'yxz', 'yzx', 'zxy', 'zyx'] 2. Input: 'bca' Output: ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']

Suggested Answer

Practice More Questions Like This

Generate unlimited interview questions with structured answers, code runner, and AI-powered walkthroughs.

No credit card required

More Backend Engineer Interview Prep

Link copied to clipboard