FastPrepBreak a Palindrome
Problems/Break a Palindrome

Break a Palindrome

Roblox logoRoblox● HardINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: This is a rebuilt version. It is about 75% the same as three original Roblox online assessment reports written by their authors. From the reports: change one character of a palindrome to get the smallest possible non-palindrome in dictionary order, and return IMPOSSIBLE when no answer exists. We chose the exact function signature, an interface with lowercase English letters, the constraints, the examples, and how edge cases are shown. The reports did not show these.

You are given a lowercase string palindrome that is a palindrome. Change exactly one character so that the result is not a palindrome.

Among all valid results, return the lexicographically smallest one. If changing exactly one character cannot produce a non-palindrome, return "IMPOSSIBLE".

Two strings of the same length are compared lexicographically by the first position at which they differ.

Function

breakPalindrome(palindrome: String) → String

Examples

Example 1

palindrome = "abccba"return = "aaccba"

Changing the first non-'a' character in the left half gives the smallest possible non-palindrome.

Example 2

palindrome = "a"return = "IMPOSSIBLE"

Every one-character string is a palindrome, so no one-character change can make it non-palindromic.

Example 3

palindrome = "aa"return = "ab"

The left character is already 'a'; changing the final character to 'b' gives the smallest valid result.

Example 4

palindrome = "aba"return = "abb"

Changing the middle character would preserve the palindrome, so the smallest valid choice is to change the final character to 'b'.

Constraints

  • 1 <= palindrome.length <= 100000
  • palindrome contains lowercase English letters.
  • palindrome is a palindrome.
  • You must change exactly one character.

More Roblox Online Assessment questions

  • Centered Block Placement QueriesOA · Seen Oct 2026
  • Robot Navigation Around LasersOA · Seen Oct 2026
  • Factory Batch Profit (Game Adaptation)OA · Seen Sep 2026
  • Nested Recipe Blocks (Game Adaptation)OA · Seen Sep 2026
  • Vehicle Builds for Required Terrain (Game Adaptation)OA · Seen Sep 2026
  • Track Received Byte RangesOA · Seen Sep 2026
  • Inventory Discount TrackerOA · Seen Sep 2026
  • Count Pairs Differing in One DigitOA · Seen Oct 2025
  • Find Zero Cells in a 2×2 GridOA · Seen Oct 2025
  • Cat Route Budget Planning (Game Adaptation)OA · Seen Aug 2025

Similar questions at other companies

  • Balance a Chemical EquationMicrosoft · OAMicrosoft interview questions
  • Binary CircuitAkuna Capital · OAAkuna Capital interview questions
  • Minimum Numeric Code TransformationAdobe · OAAdobe interview questions
  • Good SubsequencesNutanix · OANutanix interview questions
  • Minimize Expression with ParenthesesPinterest · OAPinterest interview questions
  • Guess the WordGoogle · OA · PHONE SCREENGoogle interview questions
  • String Transformation (Also for Infra Automation Intern)Snowflake · OASnowflake interview questions
  • Sum of All ValuesFlexport · OAFlexport interview questions
  • Find Number of Possible Unique Strings 🍏Amazon · OA
  • Smallest Value for a Linear Expression ModuloIntel · OA

Interview reports that mention this question

  • Roblox OA: What It Tests (2026)

Roblox interview experiences

  • Roblox New Grad Early OA Tasks: 10 Experiences (Part 7 of 7)
  • Roblox New Grad Engineer Rounds: 13 Experiences (Part 6 of 7)
  • Roblox New Grad HackerRank OA: 18 Experiences (Part 5 of 7)
  • Roblox New Grad CodeSignal Finals: 23 Experiences (Part 4 of 7)
  • Roblox New Grad Games and BQ: 25 Experiences (Part 3 of 7)
All Roblox interview questionsSee Roblox hiring insights
Saved
class Solution {
    public String breakPalindrome(String palindrome) {
      // write your code here
    }
}
Checking account…