PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/IBM

Maximize palindromic strings after character swaps

Last updated: Jun 4, 2026

Quick Overview

This question evaluates proficiency in string manipulation, combinatorial character-count reasoning, and redistribution of characters under constrained swap operations within the Coding & Algorithms domain.

  • medium
  • IBM
  • Coding & Algorithms
  • Software Engineer

Maximize palindromic strings after character swaps

Company: IBM

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given an integer n and an array of n lowercase strings `arr`. Operation (can be performed any number of times): choose two different strings `arr[i]` and `arr[j]`, pick one character from each string, and swap those two characters. After performing any sequence of such swaps, return the **maximum possible number of strings in `arr` that are palindromes**. Notes: - You may swap characters between any pair of strings, and you may repeat operations indefinitely. - Each string’s **length must remain the same**. Example: - Input: `arr = ["pass", "sas", "asps", "df"]` - Output: `3` (it is possible to make 3 of the strings palindromes).

Quick Answer: This question evaluates proficiency in string manipulation, combinatorial character-count reasoning, and redistribution of characters under constrained swap operations within the Coding & Algorithms domain.

Related Interview Questions

  • Reverse last two characters with space - IBM (nan)
  • Compute minimum rooms for meeting schedule - IBM (nan)
  • Find minimum subarray length with k distinct integers - IBM (medium)
  • Find minimum operations to make array sorted - IBM (easy)
  • Implement valid 1-D convolution - IBM (Medium)
IBM logo
IBM
Jan 31, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
5
0

You are given an integer n and an array of n lowercase strings arr.

Operation (can be performed any number of times): choose two different strings arr[i] and arr[j], pick one character from each string, and swap those two characters.

After performing any sequence of such swaps, return the maximum possible number of strings in arr that are palindromes.

Notes:

  • You may swap characters between any pair of strings, and you may repeat operations indefinitely.
  • Each string’s length must remain the same .

Example:

  • Input: arr = ["pass", "sas", "asps", "df"]
  • Output: 3 (it is possible to make 3 of the strings palindromes).

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More IBM•More Software Engineer•IBM Software Engineer•IBM Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.