if we are considering continuous sub arrays, then why can't we use prefix sum instead? this is my code int minSubArrayLen(int target, vector& nums) { int sum=0; for(int i=0;i=0;i--){ if(sum-nums[i]==target){ return count; } count++; } if(sum==target){ return count; } return 0; } but giving wrong answer for array [1,2,3,4,5], whose sum equal 11.
Got it in one go. Very nice explaination sir ❤
Sir... please drop a recursion playlist. Pleaseeeee. I find it very confusing. The way you teach is very crisp and clear with all the illustrations.
I need to do that soon
I make my self change to understand (solve problem) all video of this channel
if we are considering continuous sub arrays, then why can't we use prefix sum instead?
this is my code
int minSubArrayLen(int target, vector& nums) {
int sum=0;
for(int i=0;i=0;i--){
if(sum-nums[i]==target){
return count;
}
count++;
}
if(sum==target){
return count;
}
return 0;
}
but giving wrong answer for array [1,2,3,4,5], whose sum equal 11.
great video😄
Thanks
What is the time complexity of this solution ?
That will be O(n) since you are traversing the array only once
great
awesome
From some of past day i found you and really impressed with you, and want to know more about you sir and connect with you in LinkedIn could we??
❤
DSA sheet🙃