Generate Palindromic Permutations
Updated
Problem statement
Given a lowercase English string s, return every distinct palindrome that can be formed using all of its characters, in lexicographic order. Return an empty array when none exists.
Function
generatePalindromes(s: String) → String[]Examples
Example 1
s = "aabb"return = ["abba","baab"]Example 2
s = "abc"return = []Constraints
1 <= s.length <= 14.scontains lowercase English letters only.
More Motive Onsite Interview questions
- Group AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
- Longest Equal-Zero-One SubarrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
- Maximum Weighted Sum After Left RotationsONSITE INTERVIEW · Seen Jan 2026
- Valid Parenthesis StringPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
- Best Time to Buy and Sell StockONSITE INTERVIEW · Seen Dec 2025
- Target Triplet SumONSITE INTERVIEW · Seen Dec 2025
- Validate IP AddressONSITE INTERVIEW · Seen Dec 2025
- Minimum Swaps to Group Circular OnesONSITE INTERVIEW · Seen Dec 2025
- Staircase Search In A Sorted MatrixONSITE INTERVIEW · Seen Dec 2025
- Search in Rotated Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2025
Similar questions at other companies
- All Long Subsequences Are Dictionary WordsGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
- Word Pattern II (Round 1, LC 291 :)Microsoft · ONSITE INTERVIEWMicrosoft interview questions
- Word Break IIAmazon · PHONE SCREEN · ONSITE INTERVIEW
- Word Break IIBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
- Numeric Poker OperationsRippling · PHONE SCREENRippling interview questions
- Maximum Unique Substring SplitThe Walt Disney Company · PHONE SCREENThe Walt Disney Company interview questions
- Word Break IIWex · PHONE SCREEN
- File System Shell CommandsHarvey · ONSITE INTERVIEWHarvey interview questions
- Most Frequent Call Path From Function Trace LogsRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
- Shortest Uncommon SubstringAirbnb · ONSITE INTERVIEWAirbnb interview questions