Grokking the Engineering Manager Coding Interview
Ask Author
Back to course home

0% completed

Vote For New Content
Smallest Subarray With a Greater Sum solution has a bug

karrad

Aug 23, 2023

I think there is a bug in the solution.

The line

min_length = min(min_length, window_end - window_start) should be min_length = min(min_length, window_end - window_start + 1)

It works with the +1.

Murthy

0

0

Comments
Comments
K
karrad 2 years ago

Sorry! Was not paying attention.

Design Gurus
Design Gurus7 months ago

This is exactly what is mentioned in the given solution. If you have local changes, please revert to the default code from the top right corner.

 min_length = min(min_length, window_end - window_start + 1)