Skip to the content.

Asked by Amazon

Question

Given a string, find the length of the smallest window that contains every distinct character. Characters may appear more than once in the window.

For example, given "jiujitsu", you should return 5, corresponding to the finalĀ fiveĀ letters.