Tap here to switch tabs
Problem
Submissions

Problem: Select K Disjoint Special Substrings

med
30 min
Try to solve the Select K Disjoint Special Substrings problem.

Statement

Given a string s and an integer k, determine whether it is possible to select at least k pairwise disjoint non empty substrings such that each selected substring is special.

A substring is called special if it satisfies the following conditions:

  • It is non empty.

  • No character appearing in the substring appears anywhere outside of it in s.

  • The substring is not the entire string s.

Return true if at least k such pairwise disjoint special substrings can be chosen, and false otherwise.

Constraints:

  • 2≤‘n‘==ext‘s.length‘≤5imes1042 \leq `n` == ext{`s.length`} \leq 5 imes 10^4

  • 0≤‘k‘≤260 \leq `k` \leq 26

  • s consists only of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Select K Disjoint Special Substrings

med
30 min
Try to solve the Select K Disjoint Special Substrings problem.

Statement

Given a string s and an integer k, determine whether it is possible to select at least k pairwise disjoint non empty substrings such that each selected substring is special.

A substring is called special if it satisfies the following conditions:

  • It is non empty.

  • No character appearing in the substring appears anywhere outside of it in s.

  • The substring is not the entire string s.

Return true if at least k such pairwise disjoint special substrings can be chosen, and false otherwise.

Constraints:

  • 2≤‘n‘==ext‘s.length‘≤5imes1042 \leq `n` == ext{`s.length`} \leq 5 imes 10^4

  • 0≤‘k‘≤260 \leq `k` \leq 26

  • s consists only of lowercase English letters.