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

0% completed

Vote For New Content
Hi. Wondering how to deduce that "Fruits into Baskets" is sliding window pattern...

CS

Oct 6, 2021

Hi. Wondering how to deduce that "Fruits into Baskets" is sliding window pattern? Any pointers?

0

0

Comments
Comments
Design Gurus
Design Gurus4 years ago

If you look closely, it is quite similar to "Longest Substring with K Distinct Characters." Here, we are trying to find the longest subarray with two distinct characters ( the two characters are analogous to the two fruit types.)

On this page