Sliding Window: Subarray Sums Divisible by K | Subarray Product Less Than K

  Рет қаралды 6,516

Coder Army

Coder Army

Күн бұрын

Пікірлер: 47
@joydeep-halder
@joydeep-halder 6 ай бұрын
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-mb5pu
@Sanataniblood-mb5pu 4 ай бұрын
Unbelievable content i never thought this type of content is free 😮🗿
@ramsiyaram10082
@ramsiyaram10082 4 ай бұрын
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_iliyas
@asad_iliyas 5 ай бұрын
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; }
@heetpatel3037
@heetpatel3037 5 ай бұрын
Jai shree Ram ❤️ ek number content har ek video me aap world 🌍 pakka top 1% me honge thank you bhaiya
@ramsiyaram10082
@ramsiyaram10082 4 ай бұрын
bhaiya sach me maje aa gaye thanks bhaiya
@JeetYadav-i6w
@JeetYadav-i6w 6 ай бұрын
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-i6w
@JeetYadav-i6w 6 ай бұрын
Sir reply please
@ankushladani496
@ankushladani496 6 ай бұрын
Bhaiya Mene 1st problem ka solution khudse find krliya...😇😄 Thank you...
@mohit6215
@mohit6215 6 ай бұрын
G.O.A.T of all dsa series ❤❤
@joydeep-halder
@joydeep-halder 6 ай бұрын
1:07:33 Condition will be if(k
@asad_iliyas
@asad_iliyas 5 ай бұрын
it will be if(k==0 || k==1) return 0; because product of positive numbers can never be less than 1
@crucial4years1110
@crucial4years1110 6 ай бұрын
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-q9t
@Abhishek-q9t 6 ай бұрын
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; } };
@chanchalsoni7535
@chanchalsoni7535 4 ай бұрын
proud to be part of coder army🥰😇
@YashSaini007
@YashSaini007 6 ай бұрын
Bhaiya Radhe Radhe 🙏
@Sangi-sj2dy
@Sangi-sj2dy 5 ай бұрын
Simply Awesome ♥♥♥♥
@allinonemoviesyt
@allinonemoviesyt 6 ай бұрын
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; }
@imran3509
@imran3509 6 ай бұрын
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; } };
@banamalihaldar1345
@banamalihaldar1345 6 ай бұрын
Good evening
@CalmingVideos-qm3rn
@CalmingVideos-qm3rn 6 ай бұрын
Top level content ❤
@sahilthakur9081
@sahilthakur9081 6 ай бұрын
Bhaiya graph or dp playlist kb shuru kr rhe ho?
@shubhamkumarjha9192
@shubhamkumarjha9192 6 ай бұрын
Good evening boss..
@harshrajjordan6534
@harshrajjordan6534 3 ай бұрын
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; } };
@nishantraj7209
@nishantraj7209 4 ай бұрын
maza aa rha hai bhaiya
@imran3509
@imran3509 6 ай бұрын
Largest subarray with 0 sum please rohit negi
@ramsiyaram10082
@ramsiyaram10082 4 ай бұрын
@seekingsoul871
@seekingsoul871 6 ай бұрын
Maja aa gaya.
@Sanataniblood-mb5pu
@Sanataniblood-mb5pu 4 ай бұрын
❤❤❤❤
@ankushladani496
@ankushladani496 6 ай бұрын
Thanks Bhaiya...✅💪
@harshitpatil6138
@harshitpatil6138 4 ай бұрын
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-mb5pu
@Sanataniblood-mb5pu 4 ай бұрын
42:19 bhaiya give the ans of The Hardest Question of this lecture 😉😂
@SajibRoy-rr3px
@SajibRoy-rr3px 6 ай бұрын
Bhaiya graph ka video kupse upload korenge??
@harshgautam6260
@harshgautam6260 6 ай бұрын
bhaiya will your dsa course be enough to crack maang or any other big techs
@vinodbarti9237
@vinodbarti9237 6 ай бұрын
yup
@mohit6215
@mohit6215 6 ай бұрын
Bhaiya BACKTRACKING,HASHMAPS
@hiteshsharma5034
@hiteshsharma5034 6 ай бұрын
gud evening bro..
@SujeetKumar-xm2xd
@SujeetKumar-xm2xd 6 ай бұрын
❤❤❤❤❤
@itshirdeshk
@itshirdeshk 6 ай бұрын
Day 194 ✅🔥
@PradeepKumar-bc1ez
@PradeepKumar-bc1ez 3 ай бұрын
Chamak gya++
@YashSaini007
@YashSaini007 6 ай бұрын
#180DaysOfCode
@ravikushwaha9620
@ravikushwaha9620 6 ай бұрын
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?
@vasusrivastav
@vasusrivastav 6 ай бұрын
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 ❤❤
@vasusrivastav
@vasusrivastav 6 ай бұрын
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❤
@chanchalsoni7535
@chanchalsoni7535 4 ай бұрын
can you please tag my comment...
@beastboy-OP
@beastboy-OP 6 ай бұрын
First comment 😂
@TechFundaa90
@TechFundaa90 6 ай бұрын
❤❤❤❤❤❤
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 31 МЛН
One day.. 🙌
00:33
Celine Dept
Рет қаралды 42 МЛН
Subarray Product Less Than K - Leetcode 713 - Python
10:26
NeetCodeIO
Рет қаралды 17 М.
974. Subarray Sums Divisible by K | PrefSum | Not an Easy Problem
17:19
Bipartite Graph | BFS + DFS + Code + Real Life application
1:13:28
Subarray Sum Equals K - Prefix Sums - Leetcode 560 - Python
15:19
Subarray Sums Divisible by K | leetcode 974 | Hindi
13:10
Codebix
Рет қаралды 16 М.