FastPrepSplit a String into Three Palindromes
Problems/Split a String into Three Palindromes

Split a String into Three Palindromes

Oracle logoOracle● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Oracle onsite interview. The report asks for an exact split into three non-empty palindrome pieces. It specifically asks for a dynamic-programming speedup for the palindrome checks. It does not give a function signature, the characters used, examples, or input limits. Our version is about 95% the same as the reported question.

Given a string s, return true if it can be split into exactly three non-empty contiguous substrings such that every substring is a palindrome. Otherwise, return false.

A palindrome reads the same from left to right and right to left. The three substrings must preserve the original order and together use every character of s exactly once.

Function

canSplitIntoThreePalindromes(s: String) → boolean

Examples

Example 1

s = "abcbdd"return = true

One valid split is "a" | "bcb" | "dd". All three pieces are non-empty palindromes.

Example 2

s = "bcbddxy"return = false

No placement of two split points makes all three resulting substrings palindromes.

Example 3

s = "aaa"return = true

The only valid three-part split is "a" | "a" | "a", and each one-character substring is a palindrome.

Constraints

  • 3 <= s.length <= 2000.
  • s contains only lowercase English letters.

More Oracle Onsite Interview questions

  • Course ScheduleONSITE INTERVIEW · Seen Nov 2026
  • Shortest Subarray with Sum at Least KONSITE INTERVIEW · Seen Nov 2026
  • Longest Substring Without Repeating CharactersONSITE INTERVIEW · Seen Nov 2026
  • Minimum Meeting RoomsONSITE INTERVIEW · Seen Nov 2026
  • Shortest Window with Required CountsONSITE INTERVIEW · Seen Nov 2026
  • Maximum Subarray Sum with One DeletionONSITE INTERVIEW · Seen Nov 2026
  • Shortest Deletion for Distinct CharactersONSITE INTERVIEW · Seen Nov 2026
  • Count Dropped Rate-Limited RequestsONSITE INTERVIEW · Seen Nov 2026
  • Design Authentication ManagerONSITE INTERVIEW · Seen Oct 2026
  • Maximum Bouquet ValueONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Word BreakAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Word BreakGoogle · ONSITE INTERVIEWGoogle interview questions
  • Reconstruct One Sentence From a DictionaryMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Scramble StringExpedia · ONSITE INTERVIEWExpedia interview questions
  • Word BreakMoveworks · ONSITE INTERVIEWMoveworks interview questions
  • Validate a Palindrome After Limited DeletionsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
  • Decode Numeric StringArcesium · ONSITE INTERVIEWArcesium interview questions
  • Word BreakBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Count Vowel PermutationsZscaler · ONSITE INTERVIEWZscaler interview questions
  • Minimum Steps on a Circular Character DialNavan · ONSITE INTERVIEWNavan interview questions

Oracle interview experiences

  • Oracle SWE Onsite Interview Experience: 1 Experience
All Oracle interview questionsSee Oracle hiring insights
Saved
class Solution {
    public boolean canSplitIntoThreePalindromes(String s) {
        // Write your code here.
    }
}
Checking account…