Instead of the stating the "rules" try to explain the concept that why these "rules" are used. Just make me understand the concept, Rules are coders to make.
Why you not include the time complexity of Qi.pop_back(); In worst case if we traverse dq backward k times than this traversal is also included in O(n), please clear the doubt
Good explanation in simple words. Keep up the good work Your explanation helped me solve a question of competitive programming even though I just watched the logic and not the code. Thank you so much :)
for python devs , def sub_max(array, k): result = [] for i in range(0,len(array)-k+1): temp_max = max(array[i+inst] for inst in range(0,k)) result.append(temp_max) return result
When the new element comes in the second window, we'd like to compare that to the elements present to the left of it. Hence, we run a while loop that checks whether the element to the left is greater than that of the new element coming in the window; if true, pop that left element and will add the one coming. And will continue to do so till it reaches the first position i.e. the only element present in dq. I understand that the problem is not itself really tough but the concept of choosing an array index rather than element for printing them in a specific order(given in question) makes it a bit tricky.
@@abhiraj.sharma yeah bro.. thats ok I am saying its sufficient to write an if condition instead of while to pop out the only front element after each iteration if its not present in the window anymore.. btw I got it accepted thnx for reply
Just watch from 5:00 to 6:30.Thats enough to understand the best solution
Thanks for the heads up.
Thanks, dude, just watched in 2x from 5:00 to 7:06
Sure, but I liked starting a little early from 4:08.
best explanation ever , from any youtube video
Instead of the stating the "rules" try to explain the concept that why these "rules" are used. Just make me understand the concept, Rules are coders to make.
Immediatly last package on windows size after process everything, you MUST put first value in Deque to Result.
Good explanation for the deque method
Why you not include the time complexity of Qi.pop_back();
In worst case if we traverse dq backward k times than this traversal is also included in O(n), please clear the doubt
thanks for the explanation
thank you so much for the solution
thanks for your explanation, I could not come up with the solution using deque!
This question is solved and made by satan itself :P
:V :V :V
she is so confused
Good explanation in simple words. Keep up the good work
Your explanation helped me solve a question of competitive programming even though I just watched the logic and not the code. Thank you so much :)
Keep vale’s of array as a b c d instead of numbers
for python devs ,
def sub_max(array, k):
result = []
for i in range(0,len(array)-k+1):
temp_max = max(array[i+inst] for inst in range(0,k))
result.append(temp_max)
return result
This explanation of deque , is seriously one of the most useless i have ever seen
gr8 explaination mate❤❤❤
Thanks for elaborating the logic behind the problem.It was helpful.
Bhut hagga
but in each iteration why we have to use while loop for deleting elements that are not in the present window. No more than one element can be removed
When the new element comes in the second window, we'd like to compare that to the elements present to the left of it.
Hence, we run a while loop that checks whether the element to the left is greater than that of the new element coming in the window; if true, pop that left element and will add the one coming. And will continue to do so till it reaches the first position i.e. the only element present in dq.
I understand that the problem is not itself really tough but the concept of choosing an array index rather than element for printing them in a specific order(given in question) makes it a bit tricky.
@@abhiraj.sharma yeah bro.. thats ok I am saying its sufficient to write an if condition instead of while to pop out the only front element after each iteration if its not present in the window anymore.. btw I got it accepted thnx for reply
Nice explanation. Didn't understand the reason of dislikes tho...
Keep up nonetheless :)
nice explanation, keep it up
good explanation... maam...
Will u please provide the explanation for method 4.
can it be done using priority_queue.
Whenever we move to new window😅
This was very helpful, thanks
so many mistakes she did while explaining deque method
Really Very Nice and Helpful Video.
Nice.
bad explain
Why do everyone has to code in c++ only .... gfg u need to work on it .. In industry level there is more use of java as compared to c++
poor vocab
Errrrrrrrrrrr.......so irritating ur voice is .....y r u taking so many breaks in between
mat dekho fir
bad explanation, feels like cramming up the code
The deque approach is not of the order n at all.
Its O(2n) because every element is explored (added to queue or removed from queue) at most twice