FastPrepMinimum Insertions to Make a Palindrome
Problems/Minimum Insertions to Make a Palindrome

Minimum Insertions to Make a Palindrome

Intuit logoIntuit● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Intuit new grad online assessment. The report says it is a variant of shortest palindrome. Characters may be inserted anywhere in the original string. Find the minimum number of added characters.

The report does not give a character set or size limit. Here, the string has at most 1000 lowercase English letters.

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

Given a string s, return the minimum number of characters that must be inserted to make it a palindrome.

You may insert a character at any position, including either end. You may not delete, replace, or reorder the original characters. A palindrome reads the same from left to right and from right to left. The empty string is already a palindrome.

For this exercise, assume that the string contains only lowercase English letters.

Function

minInsertions(s: String) → int

Examples

Example 1

s = "abc"return = 2

Insert b and a after the final character to get abcba. Two insertions are necessary because the three original characters are all different.

Example 2

s = "racecar"return = 0

The input already reads the same in both directions.

Constraints

  • For this exercise, assume 0 <= s.length <= 1000.
  • Every character is a lowercase English letter.

More Intuit Online Assessment questions

  • Employee Promotion OpportunitiesOA · Seen Oct 2026
  • Next Pascal Row CoefficientOA · Seen Oct 2026
  • Parse Router LogsOA · Seen Oct 2026
  • Longest Repeated Letter Block with Adjacent SwapsOA · Seen Oct 2026
  • Maximum Square-Free DivisorOA · Seen Oct 2026
  • Two Tribes from Taller-Person CountsOA · Seen Oct 2026
  • Shortest Path from an Encoded GraphOA · Seen Sep 2026
  • Oldest and Youngest EmployeesOA · Seen Sep 2026
  • Pressure-Isolation Shutdown OrderOA · Seen Sep 2026
  • Submask Sum QueriesOA · Seen Sep 2026

Similar questions at other companies

  • Maximum Equal-Bit Pairs in a SubsequenceAmazon · OA
  • Longest Subsequence That Is a SubstringBooking.com · OA
  • Count Digit Replacements with No Equal Adjacent DigitsMicrosoft · OAMicrosoft interview questions
  • Palindrome CounterGoldman Sachs · OAGoldman Sachs interview questions
  • Longest String ChainVisa · OAVisa interview questions
  • Minimum-Cost Digit String DecodingSquadStack.ai · OA
  • Maximum Redundancy After One Segment FlipBloomberg LP · OABloomberg LP interview questions
  • Substrings Without a Target SubsequencePhonePe · OAPhonePe interview questions
  • Minimum Edit-Distance String for Each QueryTarget · OA
  • Longest Subsequence That Is a SubstringWells Fargo · OAWells Fargo interview questions

Interview reports that mention this question

  • Intuit OA: What It Tests (2026)

Intuit interview experiences

  • Intuit Software Engineering Intern - Full Stack OA Format
All Intuit interview questionsSee Intuit hiring insights
Saved
class Solution {
    public int minInsertions(String s) {
        // Write your code here
    }
}
Checking account…