Shortest Substring to Delete for Distinct Characters

Asked at Oracle · Coding Questions · Difficulty: Medium · Last asked Nov 11, 2026

You are given a string of lowercase letters. You may delete one contiguous block of characters from it, and the characters before and after the block are joined together. Find the smallest block length that leaves a string in which no character appears twice.

Loading the problem…