Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
I don't understand the purpose of minLength? like it is the length of the entire...

Alan Ross

Oct 6, 2022

I don't understand the purpose of minLength? like it is the length of the entire string + 1, why is it called minLength? There's no explanation as to why it's called that and what it's used for.

0

0

Comments
Comments
Design Gurus
Design Gurus3 years ago

minLength is the length of the 'smallest substring' that we are trying to find.

It is initialized with the maximum value (which is the length of the original string + 1).

Whenever we get a smaller string (with all the character occurrences of the given pattern), we u...

A
Alan Ross3 years ago

Oh thank you very much, that makes sense now.

On this page