HW Solution: Count Subarrays with score less than K. This is similar to product less than K. Difference is here, we have to keep eye on score. class Solution { public: long long countSubarrays(vector& nums, long long k) { int n = nums.size(); long long sum = 0, score = 0; long long count = 0; int start = 0, end = 0; while(end < n){ sum += nums[end]; score = sum * (end-start+1); while(score>=k && start
@Sanataniblood-mb5pu4 ай бұрын
Unbelievable content i never thought this type of content is free 😮🗿
@ramsiyaram100824 ай бұрын
thanks bhaiya due to your effort I solve this HW problem class Solution { public: long long countSubarrays(vector& nums, long long k) { if(k
@asad_iliyas5 ай бұрын
H/W = long long countSubarrays(vector& nums, long long k) { long long count=0; int start=0,end=0,n=nums.size(); long long sum=0; while(end=(k*1.0)/(end-start+1)){ sum-=nums[start]; start++; } count+=end-start+1; end++; } return count; }
@heetpatel30375 ай бұрын
Jai shree Ram ❤️ ek number content har ek video me aap world 🌍 pakka top 1% me honge thank you bhaiya
@ramsiyaram100824 ай бұрын
bhaiya sach me maje aa gaye thanks bhaiya
@JeetYadav-i6w6 ай бұрын
Sir, App ke videos bohot helpful rehte hai Deep concepts ko clear karte hai aise hi aur videos banao Python ya java ke liye From hyderabad Aapke long playlist 100 hours ke bohot helpful and deep rehte hai jaise ki offline classes sunrahe ho Thank you
@JeetYadav-i6w6 ай бұрын
Sir reply please
@ankushladani4966 ай бұрын
Bhaiya Mene 1st problem ka solution khudse find krliya...😇😄 Thank you...
@mohit62156 ай бұрын
G.O.A.T of all dsa series ❤❤
@joydeep-halder6 ай бұрын
1:07:33 Condition will be if(k
@asad_iliyas5 ай бұрын
it will be if(k==0 || k==1) return 0; because product of positive numbers can never be less than 1
@crucial4years11106 ай бұрын
Hw solution:- long long countSubarrays(vector& nums, long long k) { long long ans=0; int n=nums.size(); long long prefix=0; int start =0,end=0; while(end < n) { prefix+=nums[end]; while(prefix*(end-start+1) >= k &&start
@Abhishek-q9t6 ай бұрын
class Solution { public: long long countSubarrays(vector& nums, long long k) { long long total=0,start=0,end=0,sum=0; int n=nums.size(); while(end=k) { sum-=nums[start]; start++; } total+=(end-start)+1; end++; } return total; } };
@chanchalsoni75354 ай бұрын
proud to be part of coder army🥰😇
@YashSaini0076 ай бұрын
Bhaiya Radhe Radhe 🙏
@Sangi-sj2dy5 ай бұрын
Simply Awesome ♥♥♥♥
@allinonemoviesyt6 ай бұрын
1:07:53 Homework Question : long long countSubarrays(vector& nums, long long k) { long long ans = 0; int i=0; int j=0; long long sum = 0; while(j != nums.size()){ sum += nums[j]; long long score = sum*(j-i+1); if(score < k){ ans += (j-i+1); j++; } else{ if(i==j){ i++; j++; sum = 0; } else{ sum -= nums[i]; i++; sum -= nums[j]; } } } return ans; }
@imran35096 ай бұрын
this is a better solution class Solution { public: long long countSubarrays(vector& nums, long long k) { long long int count=0; long long int prefix_sum=0; long long int i=0; long long int j=0; for(i=0,j=0;i=k) { prefix_sum-=nums[j]; j++; } count=count+(i-j+1); } } return count; } };
@banamalihaldar13456 ай бұрын
Good evening
@CalmingVideos-qm3rn6 ай бұрын
Top level content ❤
@sahilthakur90816 ай бұрын
Bhaiya graph or dp playlist kb shuru kr rhe ho?
@shubhamkumarjha91926 ай бұрын
Good evening boss..
@harshrajjordan65343 ай бұрын
Home-Work:- class Solution { public: long long countSubarrays(vector& nums, long long k) { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long ans = 0, p = 0; long long first = 0, second = 0; while (second < nums.size()) { p += nums[second]; while ((p * (second - first + 1)) >= k) { p -= nums[first++]; } ans += (second - first + 1); second++; } return ans; } };
@nishantraj72094 ай бұрын
maza aa rha hai bhaiya
@imran35096 ай бұрын
Largest subarray with 0 sum please rohit negi
@ramsiyaram100824 ай бұрын
@seekingsoul8716 ай бұрын
Maja aa gaya.
@Sanataniblood-mb5pu4 ай бұрын
❤❤❤❤
@ankushladani4966 ай бұрын
Thanks Bhaiya...✅💪
@harshitpatil61384 ай бұрын
Que 3 --> Solution Count subArray with score less than k long long countSubarrays(vector& nums, long long k) { long long ans = 0; long long preSum = 0; int i=0, j=0; int length = 0; long long product = 1; while(j < nums.size()){ preSum += nums[j]; length++; product = preSum * length; if(product < k){ ans += (j-i+1); j++; } else{ while(i = k){ preSum -= nums[i]; length--; product = preSum * length; i++; } if(product < k){ ans += (j-i+1); } j++; } } return ans; } }; Like if help😄
@Sanataniblood-mb5pu4 ай бұрын
42:19 bhaiya give the ans of The Hardest Question of this lecture 😉😂
@SajibRoy-rr3px6 ай бұрын
Bhaiya graph ka video kupse upload korenge??
@harshgautam62606 ай бұрын
bhaiya will your dsa course be enough to crack maang or any other big techs
@vinodbarti92376 ай бұрын
yup
@mohit62156 ай бұрын
Bhaiya BACKTRACKING,HASHMAPS
@hiteshsharma50346 ай бұрын
gud evening bro..
@SujeetKumar-xm2xd6 ай бұрын
❤❤❤❤❤
@itshirdeshk6 ай бұрын
Day 194 ✅🔥
@PradeepKumar-bc1ez3 ай бұрын
Chamak gya++
@YashSaini0076 ай бұрын
#180DaysOfCode
@ravikushwaha96206 ай бұрын
Kya kisi ke paas is course ke notes mil sakte hai kyuki notes banane me bahut time lagta hai yadi kisi ne proper notes banaya hai?
@vasusrivastav6 ай бұрын
Hello bhaiya, aap se ek video boli thi ki apka 180 day DSA kese follow karu means playlist mai 100 approx video hai oor live stream wali kis din Hui idea nhi mil Raha oor phir aab wali DSA kese follow karu uske baad , please help Bhaiya ❤❤
@vasusrivastav6 ай бұрын
Ho sake toh bhaiya aaj hi post mai ya video bana do iss pe , kyuki mujhe bhi start karna hai phir apke pace pe apke saath saath karna hai Thank you bhaiya❤