in this provided code he made the dqueue deque dq; with integer data type replace it with long long new test case has been added in leetcode so due to overflow you will get wrong ans . so use long long
Can you plz tell time gap between 2nd round and 3rd round bcoz I cleared 2nd round 1.5 months ago but still haven't got round 3 mail and also i haven't got rejection mail.
Hello Sir, if possible make a playlist of all important questions for interviews.This would help the community a lot! Your way of explanation is phenomenal that's why I am requesting you to provide these super helpful playlists here on youtube so that it helps those who can't afford resources.
From the example, when we insert (4,3) why do we have to leave (2,0) to deque? As subarray should be contiguous, doesn't it also have to removed as its left to newly considering index 3?
Think of this case. [2,-1,2], k = 3 . Now we will need to keep the index of first 2 in the array as well to get monotonically increasing value of complete subarray.
in the first solution sliding window one which you said it won't work. if the right till the end, why not keep the left index and doing a seperate for loop start from this left index and shrinking again?
Calculating Max Sum of Array with the following condition, If A[i] element contributing in max sum,than you can't consider A[i]-1 and A[i]+1 element for max sum contribution, if present in array . Note: Elements of the array can be repeated multiple times. It's unsorted. It can have 1 to n number of element. eg: int A[ ]={1,6,7,1,2,3,3,4,5,5,5,6,9,10}; If I consider 10 as contributing max sum, I can consider 9 and 11. (Here 11 is not present but 9 is present still we can’t consider it). If I consider 5 (total max sum contribution 5*3) but can’t consider 4 and 6. I have tried sorting and storing index and count in the ordered map. Also try to compare with unbounded knapsack criteria. Still, I was struggling with an optimal and clear idea to calculate. Any idea how to approach it .
Think of this case. [2,-1,2], k = 3 . Now we will need to keep the index of first 2 in the array as well to get monotonically increasing value of complete subarray. So basically we can remove from deque only when the sum gets greater than k.. In other cases we should not delete it because it might be of use.
I'm new to programming, can anyone of you tell me which is the best way to start learning coding? And best platform(which has the complete content)? Any good Websites?/video courses?
I have not looked at Leetcode. I guess there are at least 1000 problems. How do one remember the logic, even after practicing or understanding the logic, I do tend to forget things. Guess its sign of aging :(
Hi, can you tell me which is the best way to start learning coding? And best platform(which has the complete content)? Any good Websites?/video courses?
Sir what about binary search approach when binary search on possible lengths and finding if this length is possible or not by sliding window, why this approach is giving me wrong on 87/97
in this provided code he made the dqueue deque dq; with integer data type replace it with long long new test case has been added in leetcode so due to overflow you will get wrong ans . so use long long
Just got an offer from amazon.
Thank you so much for your videos.
They helped me a lot when grinding leetcode🙏🙏
Can you plz tell time gap between 2nd round and 3rd round bcoz I cleared 2nd round 1.5 months ago but still haven't got round 3 mail and also i haven't got rejection mail.
Improper explanation
Thanks for being a great teacher!
Hello Sir, if possible make a playlist of all important questions for interviews.This would help the community a lot!
Your way of explanation is phenomenal that's why I am requesting you to provide these super helpful playlists here on youtube so that it helps those who can't afford resources.
Such an elegant and beautiful explanation. Thank you Surya Pratap 🙏🏽
Sir you said , you only pop when sum is >= target , what if the array is [-12,-22,-33,5] and target is 4 , how would it work in this case ?
Such a smooth explanation !
From the example, when we insert (4,3) why do we have to leave (2,0) to deque? As subarray should be contiguous, doesn't it also have to removed as its left to newly considering index 3?
Think of this case. [2,-1,2], k = 3 . Now we will need to keep the index of first 2 in the array as well to get monotonically increasing value of complete subarray.
@@harigovind11 Thanks for the explanation. Your example gave me the point I was missing.
Congratulations sir 🎉 for getting AIR 1 in Google kick start
🔥🔥🔥
Sir, on which software(Blackboard) are you writing this??
Hey, did you get it?
@@guneetmalhotra01 nope
Why monotonocity is preserved? What happens when we include negatives
I can't understand intuition behind this approach!! I have read many articles on leetcode also, but still...
in the first solution sliding window one which you said it won't work. if the right till the end, why not keep the left index and doing a seperate for loop start from this left index and shrinking again?
Calculating Max Sum of Array with the following condition, If A[i] element contributing in max sum,than you can't consider A[i]-1 and A[i]+1 element for max sum contribution, if present in array .
Note: Elements of the array can be repeated multiple times. It's unsorted. It can have 1 to n number of element.
eg:
int A[ ]={1,6,7,1,2,3,3,4,5,5,5,6,9,10};
If I consider 10 as contributing max sum, I can consider 9 and 11. (Here 11 is not present but 9 is present still we can’t consider it).
If I consider 5 (total max sum contribution 5*3) but can’t consider 4 and 6.
I have tried sorting and storing index and count in the ordered map. Also try to compare with unbounded knapsack criteria.
Still, I was struggling with an optimal and clear idea to calculate. Any idea how to approach it .
Consider storing the elements into an array (hashing) and apply house robber (kind of, but the approach would be similar) on this freqency Array
What is the intuition behind this algorithm and why monotonous increasing will work here, can anybody please explan?
Thanks for the solution, but what is the point of keep [2,0] and [4,3] in the queue, what does it represent ?, isn't it non-contiguos.
Think of this case. [2,-1,2], k = 3 . Now we will need to keep the index of first 2 in the array as well to get monotonically increasing value of complete subarray. So basically we can remove from deque only when the sum gets greater than k.. In other cases we should not delete it because it might be of use.
I'm new to programming, can anyone of you tell me which is the best way to start learning coding? And best platform(which has the complete content)? Any good Websites?/video courses?
What is the name of this tool (colour pens) which is your using to write on blackboard?
Why popping elements from the deque won't affect the result?
it doesn't make sense if you only explains a single example, also you are saying delete it if still the sum is greater but in end when 18-8
I have not looked at Leetcode. I guess there are at least 1000 problems. How do one remember the logic, even after practicing or understanding the logic, I do tend to forget things. Guess its sign of aging :(
How would this logic work out for [2, -1, 2] and target = 3 ? As per the analysis, the final queue is [ (1,1) , (3,2)]. But the answer is 3.
Hi, can you tell me which is the best way to start learning coding? And best platform(which has the complete content)? Any good Websites?/video courses?
i am also stuck on then same case, did you find any solution for it?
Guys even if leetcode test case pass , this approach is wrong for generally solving the questions, thousands of test case will fail
Such amazing explanation 😁😁
nice explanation sir!!
Sir what about binary search approach when binary search on possible lengths and finding if this length is possible or not by sliding window, why this approach is giving me wrong on 87/97
The numbers are negative also in array thus thinking that increasing window size would increase sum is wrong
Stopped making new videos?
Clean Explanation. Thanks!
Nice explanation sir
Can anyone tell me which blackboard software is this?
Great explanation with clear visualization.
Code not workingon leetcode now as few more test cases added
💥💥
:)
Not able to get the case with above approach is [5, 7, -12, 20, 5, 2, 1, 23] target =8 minimal subarray is -12, 20
minimal subarray would be 20 here cause it is greater than 8. It is giving right answer, I checked on leetcode.
Bro Did you Find any Valid answer
@@sakshigupta7616then solve for this [7,-1,6,1,1,1]
K= 9
I love you bro
Not so intuitive
cool solution but not upto mark in explaining ,