Skip to content

Practice Find Maximum Number of String Pairs

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

Easy#2744
LeetCode Problem

Find Maximum Number of String Pairs

Problem Statement

Pair distinct entries of words when one string is the reverse of the other. Each entry may belong to at most one pair. Return the maximum possible number of pairs.

Source: Find Maximum Number of String Pairs on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
words = ["cd","ac","dc","ca","zz"]
Output
2

# Example 2

Input
words = ["ab","ba","cc"]
Output
1

# Example 3

Input
words = ["aa","ab"]
Output
0

Constraints

1 <= words.length <= 50
words[i].length == 2
words consists of distinct strings.
words[i] contains only lowercase English letters.

Related LeetCode Problems

Practice more problems similar to Find Maximum Number of String Pairs.

Review your practice with PhantomCodeAI

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