Counting Subarrays #InterviewBit || Intuition + Code+ Example

preview_player
Показать описание
Problem Description

Given an array A of N non-negative numbers and you are also given non-negative number B.

You need to find the number of subarrays in A having sum less than B. We may assume that there is no overflow.
Рекомендации по теме
Комментарии
Автор

Toughest part in this question is adding size of array to count, else its similar to sliding window problems,

viralustrends
Автор

Thanks a lot, this week's contest's 3rd question - (#2762) had a similar approach. I was not able to understand the " i - j +1 " part. But Thanks to you, now I got it.

anshumantripathy
Автор

nice explanation.The way you developed the optimised solution is nice.

hitheshpk
Автор

I like the way you have explained it ❤️❤️❤️❤️ it's very easy now

nehasht
Автор

The question hasn't mentioned "contiguous sub-arrays so if A={1, 3, 5, 2, 6} and B = 5, you aren't considering the case of {1, 2}. Please explain. Thanks

nidhishparekh
Автор

Kaash ...Mam aap meri classmate hoti...to .Mai Apple me pahuch jata....

vikashsharma
Автор

Hey, great tutorial, can you explain line 19 in more details ? TIA

yadavswapnilnagnath
join shbcf.ru