FastPrepGenerate Palindromic Permutations
Problems/Generate Palindromic Permutations

Generate Palindromic Permutations

Motive logoMotive● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A firsthand Motive coding-round report for a full-time onsite interview names a well-known problem on listing all the palindromic permutations of a string.

Our version is about 99% the same as the reported question.

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.
  • s contains 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
All Motive interview questionsSee Motive hiring insights
Saved
class Solution {
    public String[] generatePalindromes(String s) {
      // write your code here
    }
}
Checking account…