Company: Ernst & Young-5 years Senior java developer_31may
Difficulty: medium
Determine the length of the shortest substring to delete from a string s of length n , so that the resulting string contains only distinct characters. When a substring is deleted, the remaining parts are joined together. If no substring needs to be deleted, the answer should be 0 . A substring is a sequence of characters that appear consecutively within a string. Example s = " abcbbck " There are three optimal choices: " abcbbck ", " abcbbck ", and " abcbc bk ". The bold characters are the substrings to remove. All result in " abck ", which has only distinct characters. The removed substring must have at least 3 characters. Return 3. Function Description Complete the function findShortestSubstring in the editor with the following parameter: string s : the string to analyze Returns: int : the length of the shortest substring that should be deleted Constraints 1 ≤ s.length ≤ 10 5 s consists of lowercase English letters only. Input F