educative.io

Minimum window subsequence test case

For the test case: “abcdbebe” , “bbe”
Why is the expected output: “bebe”? Shouldn’t it be “bcdbe”?


Course: Grokking Coding Interview Patterns in C++ - Learn Interactively
Lesson: Minimum Window Subsequence

1 Like

Hello @Hedyeh,

The problem statement asks us to find the minimum window subsequence, not the first subsequence. Although “bcdbe” is a valid subsequence with length 5, but there’s another subsequence that has a smaller length than this, i.e., “bebe” with length 4.

I hope this explanation helps. Please feel free to share more feedback and queries. We’d be happy to help. Thanks!

Happy learning!


Course: Grokking Coding Interview Patterns in Java - Learn Interactively
Lesson: Solution: Minimum Window Subsequence