FastPrepBreak a Palindrome
Problems/Break a Palindrome

Break a Palindrome

AT&T logoAT&T● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an AT&T new grad online assessment. The report names a known problem, number 1328, but leaves out the statement, the interface, the examples, and the limits. We added those. Our version is about 90% the same as the reported question.

You are given a palindromic string palindrome containing only lowercase English letters.

Replace exactly one character with another lowercase English letter so that the resulting string is not a palindrome. Return the lexicographically smallest result that can be obtained. If no valid result exists, return the empty string.

Function

breakPalindrome(palindrome: String) → String

Examples

Example 1

palindrome = "abccba"return = "aaccba"

Changing the first non-a character in the first half to a produces the smallest non-palindrome.

Example 2

palindrome = "a"return = ""

Every one-character string is a palindrome, so no valid replacement exists.

Example 3

palindrome = "aa"return = "ab"

No character in the first half can be lowered, so changing the last character to b yields the smallest valid result.

Constraints

  • 1 <= palindrome.length <= 1000.
  • palindrome contains only lowercase English letters.
  • palindrome is a palindrome.

More AT&T Online Assessment questions

  • Companies with Average Salary Above 40000OA · Seen Oct 2026
  • Count Proper Prefix MatchesOA · Seen Oct 2026
  • Minimum Binary Swaps to a PalindromeOA · Seen Oct 2026
  • 3SumOA · Seen Oct 2025
  • Advertising System Failures ReportOA · Seen Nov 2024
  • Counting Triplets Divisible by DOA · Seen Nov 2024
  • Project EstimatesOA · Seen Nov 2024

Similar questions at other companies

  • Maximum String OperationsMicrosoft · OAMicrosoft interview questions
  • Minimum No-Repeat Segments After One Character RemovalSalesforce · OASalesforce interview questions
  • Longest Non-Decreasing Substring After Pair SwapsVisa · OAVisa interview questions
  • Minimum Deletion Cost for Distinct Adjacent CharactersHSBC · OAHSBC interview questions
  • Robot Assembly Line ConflictsGoogle · OAGoogle interview questions
  • Substring RemovalJP Morgan Chase · OAJP Morgan Chase interview questions
  • Minimum Additions to Make a Valid ABC StringIBM · OAIBM interview questions
  • Maximize Workday EarningsCitadel · OA · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions
  • Minimum Adjacent TranspositionsEpic · OAEpic interview questions
  • Return Exact Cash Register ChangeBank of America · OABank of America interview questions

Interview reports that mention this question

  • AT&T TDP Software Engineer Questions: 5 Experiences
All AT&T interview questionsSee AT&T hiring insights
Saved
class Solution {
    public String breakPalindrome(String palindrome) {
      // write your code here
    }
}
Checking account…