Skip to content

Practice Count Pairs Of Similar Strings

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

Easy#2506
LeetCode Problem

Count Pairs Of Similar Strings

Problem Statement

Two strings are similar when they contain the same set of distinct characters, regardless of order or repeated occurrences. Count pairs of indices i < j in words whose strings are similar.

Source: Count Pairs Of Similar Strings on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
words = ["aba","aabb","abcd","bac","aabc"]
Output
2

# Example 2

Input
words = ["aabb","ab","ba"]
Output
3

# Example 3

Input
words = ["nba","cba","dba"]
Output
0

Constraints

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

Related LeetCode Problems

Practice more problems similar to Count Pairs Of Similar Strings.

Review your practice with PhantomCodeAI

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