I first thought of only heaps like the Median in a Data Stream problem. But sets here are much more effective. Thanks for the variations bro. Good stuff!
Content tips Provide the video solution of hardest problem (D,E,F or G) after contest and the concept behind the question or why we choose any particular Data structure.. This will be the new in youtube for those who are beginner and solve upto C type of questions , forget the fear of hard questions
Hi, I noticed you're planning a video on DSA problem-solving. I'd love to edit it for broader reach. I have 2+ years of editing experience, also worked with over 100k+ subs UA-camrs. If you want we can discuss it further
Hi bhaiya I am learning dsa for around 7-8 months from youtube and gfg, done with ds, but from recursion and backtracking when i go to solve myself not able to find the intuition by own. How can I improve.
Hi Abhishek, like here about rolling median, what we should learn apart of standard algorithm, so that we can deal the hard problems easily, any portal which u would like to suggest.
One of the important part is understanding the standard version as well as possible and proofs etc. whenever possible. If one understand the well, then probability of solving a variation increases significantly.
And This can be done easily using ordered set (pbds) ? In Today's D (weekly) It would be easy if there was no special path from x and y couldn't come up with o(n) How do we solve ?
It's not variation two, it's combination of both variation 1 and 2. In 4th problem effectively you need to find sum of k - 1 smallest elements in all subarrays of size dis. That's the answer, check code in the description if you want to see exact implementation.
One STL regarding doubt: Can you please tell me why in this line: left.erase(left.find(*left.rbegin())); a simple left.erase(left.rbegin()) is not working? It should right? Because multiset::erase() expects an iterator as a parameter, which in this case is left.rbegin()! Also in case of right.erase() its working. Am I missing something?
sir why are you adding last k elements (n-i-1 think) can't we do this using the first k elements And why are you erasing [dist+1+ind] th element if we are considering the Subarray of size dist
First K [Not first k though, you will need to skip first element as that is already taken) and last k are same thing. For your second problem, try running a dry example, that would become clearer.
Thanks, very encouraging to hear that. My goal is to consciously try to make explanations as simple as possible. Good to know it's already understandable, but hopefully should become even more clearer with time.
Today in Codechef 134 B i solved 3rd problem using it. It was amazing as you Sir.
Awesome!
I first thought of only heaps like the Median in a Data Stream problem. But sets here are much more effective. Thanks for the variations bro. Good stuff!
Yes, sets makes it relatively more convenient to solve variations, specially when we need to erase too.
Glad it was useful.
Content tips
Provide the video solution of hardest problem (D,E,F or G) after contest and the concept behind the question or why we choose any particular Data structure..
This will be the new in youtube for those who are beginner and solve upto C type of questions , forget the fear of hard questions
Can you make a video on finding the accurate mediam of an array in O(N)?
Hi, I noticed you're planning a video on DSA problem-solving. I'd love to edit it for broader reach. I have 2+ years of editing experience, also worked with over 100k+ subs UA-camrs. If you want we can discuss it further
Yes, we can discuss this more. Can you ping me on discord?
@@abhishekcode42sure kindly share
Sure kindly share
@@abhishekcode42I am the same person
Aah okay, you can ping me here abhishek_saini#6544
Can u please provide the Fenwick tree playlist , when u use and when to use
Hi bhaiya I am learning dsa for around 7-8 months from youtube and gfg, done with ds, but from recursion and backtracking when i go to solve myself not able to find the intuition by own. How can I improve.
Hi Abhishek, like here about rolling median, what we should learn apart of standard algorithm, so that we can deal the hard problems easily, any portal which u would like to suggest.
One of the important part is understanding the standard version as well as possible and proofs etc. whenever possible. If one understand the well, then probability of solving a variation increases significantly.
And This can be done easily using ordered set (pbds) ?
In Today's D (weekly)
It would be easy if there was no special path from x and y couldn't come up with o(n)
How do we solve ?
This can be solved using many things, even prioriry_queue too.
Check out my code for today's D for O(n).
I am still not able to relate how the 4th problem was the 2nd variation
It's not variation two, it's combination of both variation 1 and 2.
In 4th problem effectively you need to find sum of k - 1 smallest elements in all subarrays of size dis. That's the answer, check code in the description if you want to see exact implementation.
@@abhishekcode42 understood
is it the sliding window median problem?
One STL regarding doubt:
Can you please tell me why in this line:
left.erase(left.find(*left.rbegin()));
a simple left.erase(left.rbegin()) is not working? It should right? Because multiset::erase() expects an iterator as a parameter, which in this case is left.rbegin()! Also in case of right.erase() its working.
Am I missing something?
This happens because std::iterator and std::reverse_iterator are different. rbegin() returns std::reverse_iterator
@@abhishekcode42 Ohh...Got it! Thanks for clarifying😇
sir why are you adding last k elements (n-i-1 think) can't we do this using the first k elements
And why are you erasing [dist+1+ind] th element if we are considering the Subarray of size dist
First K [Not first k though, you will need to skip first element as that is already taken) and last k are same thing.
For your second problem, try running a dry example, that would become clearer.
Cab we use pbds to solve the problem?
Yes, Also priority_queue can also be used atleast for the asked problem by using some method to handle removing elements.
thanks bhaiya
Why do you sound highly experienced and newbie at the same time?
What do you mean? Are there mistakes in explanation?
I mean you have great knowledge and experience and still newbies like me can understand your explanation flawlessly.
Thanks, very encouraging to hear that.
My goal is to consciously try to make explanations as simple as possible.
Good to know it's already understandable, but hopefully should become even more clearer with time.
Can you please explain the approach and solutions of all the problems. I have found the approach but not able to code it.
Please try to check out my code for others, if something is not clear, you can ask here.
Thankss