Skip to content

Practice Maximum Palindromes After Operations

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#3035
LeetCode Problem

Maximum Palindromes After Operations

Problem Statement

Given an array of strings words, you may repeatedly choose any two character positions and swap their characters. The positions may belong to the same string or to different strings; each string keeps its length. Return the largest number of strings that can simultaneously be palindromes after any number of swaps.

Source: Maximum Palindromes After Operations on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
words = ["abbb","ba","aa"]
Output
3

# Example 2

Input
words = ["abc","ab"]
Output
2

# Example 3

Input
words = ["cd","ef","a"]
Output
1

Constraints

1 <= words.length <= 1000
1 <= words[i].length <= 100
words[i] consists only of lowercase English letters.

Related LeetCode Problems

Practice more problems similar to Maximum Palindromes After Operations.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.