Tap here to switch tabs
Problem
Submissions

Problem: Number of Prefix Connected Groups

Number of Prefix Connected Groups asks you to find how many groups contain at least two strings sharing the same exact prefix of length k, ignoring shorter strings.

Statement

You are given an array of strings words and an integer k.

Two words belong to the same prefix connected group if each word has a length of at least k and both share the exact same prefix of length k.

Return the total number of connected groups that contain at least 22 words.

Constraints:

  • 1≤1 \leq words.length ≤5000\leq 5000

  • 1≤1 \leq words[i].length ≤100\leq 100

  • 1≤1 \leq k ≤100\leq 100

  • All strings in words consist of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Prefix Connected Groups

Number of Prefix Connected Groups asks you to find how many groups contain at least two strings sharing the same exact prefix of length k, ignoring shorter strings.

Statement

You are given an array of strings words and an integer k.

Two words belong to the same prefix connected group if each word has a length of at least k and both share the exact same prefix of length k.

Return the total number of connected groups that contain at least 22 words.

Constraints:

  • 1≤1 \leq words.length ≤5000\leq 5000

  • 1≤1 \leq words[i].length ≤100\leq 100

  • 1≤1 \leq k ≤100\leq 100

  • All strings in words consist of lowercase English letters.