cswork / OAOpen practice workspace

MicrosoftOA #50

Minimum Substrings Without Repeating Characters

Estimated MediumStatement and editorial — judging is being prepared

Topics (AI-labelled)GreedyHashing

Giv

Constraints

N/A

Example 1

Input:

S = "word"

Output:

1

Explanation: The answer is 1 as "word" doesn't have any duplicates.

Example 2

Input:

S = "dddd"

Output:

4

Explanation: The answer is 4 as we can only form substrings "d", "d", "d", "d".

Example 3

Input:

S = "cycle"

Output:

2

Explanation: The answer is 2 as we can make substrings "cy" and "cle".

Editorial

Loading solution…