FastPrepMaximize Palindromic Words
Problems/Maximize Palindromic Words

Maximize Palindromic Words

Squarepoint Capital logoSquarepoint Capital● MediumNEW GRADOA

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The detailed approach pools character pairs and allocates them to original word lengths; its linked card names a different task. This version follows the detailed approach and makes the free-swap rules explicit, for about a 75% match to that account.

You are given words. You may swap any two character positions, including positions in different words, any number of times. Each word keeps its original length.

Return the largest number of words that can be palindromes at the same time after the swaps. A palindrome reads the same in both directions.

For this exercise, assume characters may move freely between any positions. You must keep all characters and every word length. A character left over from a pair may be used as the center of an odd-length palindrome.

Function

maximumPalindromicWords(words: String[]) → int

Examples

Example 1

words = ["aa","bc","cc"]return = 2

There are two available character pairs: one aa and one cc. Each length-two word needs one pair, so at most two can be palindromes. The arrangement ["aa","cc","bc"] reaches two.

Example 2

words = ["a","bc","def"]return = 1

No character occurs twice, so no length-two or length-three word can be a palindrome. The length-one word is always a palindrome.

Example 3

words = ["ab","ba"]return = 2

Rearrange the four characters into ["aa","bb"]. Both words are palindromes.

Constraints

  • 1 <= words.length <= 1000.
  • 1 <= words[i].length <= 1000.
  • Every character is a lowercase English letter.
  • The sum of all word lengths is at most 10000.

More Squarepoint Capital interview questions

  • Evaluating Circuit ExpressionsOA · Seen Jul 2026
  • Match an XOR-Adjusted SumOA · Seen Oct 2025
  • Minimize the Sum with Ceiling HalvesOA · Seen Oct 2025
  • Longest Increasing Subsequence from Two ArraysOA · Seen Oct 2025
  • Resolve Overlapping Price RangesOA · Seen Dec 2024
  • Empty ShelfOA · Seen Sep 2024
  • Suggested ProductsOA · Seen Sep 2024
  • Newton Square Root to a Guaranteed TolerancePHONE SCREEN · Seen Nov 2026
  • Probability of Consecutive HeadsPHONE SCREEN · Seen Nov 2026
  • Three Points in a Semicircle: Monte Carlo EstimatePHONE SCREEN · Seen Nov 2026

Similar questions at other companies

  • Minimum Distinct Prefix CostChubb · OAChubb interview questions
  • Decode Words with Anagram KeysCresta · OACresta interview questions
  • Minimum Distinct Prefix CostGoldman Sachs · OAGoldman Sachs interview questions
  • Longest String ChainVisa · OAVisa interview questions
  • Maximize Workday EarningsCitadel · OA · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions
  • Return Exact Cash Register ChangeBank of America · OA
  • Largest Binary Number by ConcatenationAdobe · OAAdobe interview questions
  • Rearrange Songs by AuthorZomato / Eternal · OAZomato / Eternal interview questions
  • Frequently Bought TogetherAmazon · OA
  • Viral Content BalancerTikTok · OATikTok interview questions

Interview reports that mention this question

  • Squarepoint Capital C++ and Python SWE Interviews: 7 Experiences

Squarepoint Capital interview experiences

  • Squarepoint Campus SDE Interviews: 7 Experiences (Part 2 of 2)
  • Squarepoint Capital New Grad SDE OA: 5 Experiences (Part 1 of 2)
All Squarepoint Capital interview questionsSee Squarepoint Capital hiring insights
Saved
class Solution {
    public int maximumPalindromicWords(String[] words) {
        // write your code here
    }
}
Checking account…