Sitemap
Jeong Tae Bang

Jeong Tae Bang

1 min readOct 21, 2018

Hey great article, it’s so helpful!

But one thing I wanted to point out as I was actually following your examples step by step:

I don’t think this gives the correct max_sum for arr = [700, 800, 900, 1, 2] and k = 3, because your very first window_sum 700+800+900 is never actually compared against max_sum.

Before we have a chance to compare against max_sum and set max_sum equal to that window_sum, you modify it in the first iteration of your second for-loop, I think.

Please let me know if I’m wrong!

--

--