#3458

Select K Disjoint Special Substrings

expert · 1200 · lc medium +32 · 19.1% accepted · 142 likes · top 1%

Description

Given string s and integer k, determine whether you can pick k non-overlapping "special" substrings.

A special substring satisfies:

- Every character that appears in it does not occur anywhere else in s.

- It is strictly shorter than the full string s.

Return true if k such disjoint substrings can be found; otherwise return false.

Code

1
2
3