All Palindrome Partitions
Updated
Problem statement
Split text into nonempty contiguous pieces so that every piece is a palindrome. Return every possible partition, preserving character order within each partition.
Comparison is case-sensitive. Return partitions in lexicographic order: compare corresponding piece strings using character order, with a proper prefix string first. If all compared pieces agree, the shorter list comes first.
Function
palindromePartitions(text: String) → String[][]Examples
Example 1
text = "BaaB"return = [["B","a","a","B"],["B","aa","B"],["BaaB"]]These are the three case-sensitive palindrome partitions.
Example 2
text = "aab"return = [["a","a","b"],["aa","b"]]The two a characters can be separate pieces or the palindrome aa.
Constraints
1 <= text.length <= 10.- text contains only uppercase or lowercase English letters.
More Expedia Online Assessment questions
- Balanced NumbersOA · Seen Aug 2026
- REST API: Discounted PriceOA · Seen Aug 2026
- Maximum Team SizeOA · Seen Mar 2026
- Per-Domain Request LimiterOA · Seen Oct 2025
- Count Equal-Frequency SubsequencesOA · Seen Mar 2025
- Count Increasing Stock PeriodsOA · Seen Mar 2025
- Get Minimum StepsOA · Seen Oct 2024
- Rank Songs by PopularityOA · Seen Oct 2024
- Calculate the SumOA · Seen Oct 2024
- Get Maximum EfficiencyOA · Seen Oct 2024
Similar questions at other companies
- First Valid Word SegmentationAmazon · ONSITE INTERVIEW
- Generate One-Two Strings with Sum NGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
- Palindrome PartitioningLondon Stock Exchange · PHONE SCREENLondon Stock Exchange interview questions
- Word Break IIWex · PHONE SCREEN
- Word Break IIInMobi · PHONE SCREENInMobi interview questions
- Word Break IIBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
- Word Break II: All SentencesMicrosoft · PHONE SCREEN · ONSITE INTERVIEWMicrosoft interview questions
- Longest Subsequence That Is a SubstringBooking.com · OA
- Palindrome CounterGoldman Sachs · OAGoldman Sachs interview questions
- Next Number with Disjoint DigitsElevenLabs · OAElevenLabs interview questions