Problem · String

Minimum Substrings Without Repeating Characters

Learn this problem
EasyMicrosoftOA
See Microsoft hiring insights

Problem statement

Given a string S, find the minimum number of substrings without repeating characters.

Function

minimumSubstringsWithoutRepeatingCharacters(S: String) → int

Examples

Example 1

S = "word"return = 1
The answer is 1 as "word" doesn't have any duplicates.

Example 2

S = "dddd"return = 4
The answer is 4 as we can only form substrings "d", "d", "d", "d".

Example 3

S = "cycle"return = 2
The answer is 2 as we can make substrings "cy" and "cle".

More Microsoft problems

drafts saved locally
public int minimumSubstringsWithoutRepeatingCharacters(String s) {
  // write your code here
}
S"word"
expected1
checking account