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

0% completed

Vote For New Content
I don't think the reason why we need to check "if min_length > window_end - wind...

Bharpur Singh

Sep 20, 2022

I don't think the reason why we need to check "if min_length > window_end - window_start + 1" in while loop and then update substr_start because everytime if matched == pattern's length then we have a valid pattern and we can shrink window and set the new start. Correct me if i am wrong.

0

0

Comments
Comments
Shubham Vora
Shubham Voraa year ago

if min_length > window_end - window_start + 1

The above line of code checks whether the newly found window has a minimum length than the previously recorded window length.

On this page