Next Greater Element | Two Variants | Leetcode

  Рет қаралды 257,209

take U forward

take U forward

Күн бұрын

Пікірлер: 229
@takeUforward
@takeUforward 3 жыл бұрын
While writing code, it should have been.. 2n-1 to 0 😅 You can also do by front passing, but that will take more time, as you have to store index, and then retract them.. leetcode.com/problems/next-greater-element-ii/discuss/98270/JavaC%2B%2BPython-Loop-Twice
@kakoli960
@kakoli960 3 жыл бұрын
I am in comment section just to check that if I am only not understanding or the code had mistakes.. thanks for this
@hh8xking30
@hh8xking30 3 жыл бұрын
@@kakoli960 and we too have to reverse the output array as we are doing operations from last. and we have to show output from first.
@akshayzade9761
@akshayzade9761 2 жыл бұрын
Thanks @Striver Correction 1 - for(int i=((2*n)-1); i>=0 ; i--) Correction 2 - while( (!stack.isEmpty()) && (stack.peek()
@subhampandey7374
@subhampandey7374 2 жыл бұрын
😄
@SwapnilSarkar
@SwapnilSarkar 2 жыл бұрын
This mistake wasted so much of my time
@nikhilpatro5905
@nikhilpatro5905 3 жыл бұрын
Dude, you have such good teaching skills! I have been a TA at coding ninjas so I know how hard it is to explain an algorithm. Please never stop teaching :)
@akshitkumar9402
@akshitkumar9402 2 жыл бұрын
> I have been a TA at coding ninjas literally nobody asked
@mudrad1930
@mudrad1930 2 жыл бұрын
so a coding ninja TA also using free resources 😂😂
@vishal40007
@vishal40007 2 жыл бұрын
@@mudrad1930 There always something new to learn
@allhdmoviescene1294
@allhdmoviescene1294 Жыл бұрын
no more learning from coding ninja
@kritidiptoghosh4272
@kritidiptoghosh4272 3 жыл бұрын
Really good explaination. Just wanted to add something for those ,who are still not 100% sure about why the stack technique is working. Just Think of the numbers as poles casting shadow(To their right,bcoz we see from left ). Lets say the next larger pole for a particular index is L. Because we are looking from the left side, when we see L we will not be able to see the poles on its right which are smaller than L because they are overshadowed. But the poles on L's right which are larger than L can still be seen because they are taller. (Thats why they are in stack). The stack at any position is literally what we would see standing there looking at right.
@abinvarkey2331
@abinvarkey2331 Жыл бұрын
thanks for that tip :)
@tear7934
@tear7934 Жыл бұрын
woah really nice intuition!! thanks
@amogu_07
@amogu_07 8 ай бұрын
thanks so much !! that's an awesome intuition !!
@thor1626
@thor1626 10 ай бұрын
the loop cond should be for (int i = (len * 2) - 1; i >= 0; i--)
@simranagarwal4813
@simranagarwal4813 8 ай бұрын
yes, u r right.
@nayanbhuyan8156
@nayanbhuyan8156 3 жыл бұрын
To make things even more simpler, if(i < n) condition is not required, instead write i % 2 in other steps, like: vector nextGreaterElements(vector& nums) { int n = nums.size(); vector res(n); stack st; for(int i = 2 * n - 1; i >= 0; i--) { while(!st.empty() && nums[i % n] >= st.top()) st.pop(); if(st.empty()) res[i% n] = -1; else res[i % n] = st.top(); st.push(nums[i % n]); } return res; }
@babai2196
@babai2196 2 жыл бұрын
thanks bro
@PIYUSH-lz1zq
@PIYUSH-lz1zq 2 жыл бұрын
for first variant why we running for 2*n-1 ... it should be done only for circular onces !!
@pranavsharma7479
@pranavsharma7479 2 жыл бұрын
@@PIYUSH-lz1zq no for first run for n-1 to 0 only
@amanbhadani8840
@amanbhadani8840 2 жыл бұрын
This code allows same values to be reassigned,thats not logical and not prefered.
@adwiteek5936
@adwiteek5936 5 ай бұрын
Avoid using maps in these circular array types of questions as you might get wrong answer by storing different value for same key in a map..... you can directly return the vector on leetcode when you will be iterating from i
@harshalgarg1149
@harshalgarg1149 3 жыл бұрын
Another approach that can be used is that first we put all the elements in stack while traversing backwards from the end and then use the same code that was used for the first variation. vector nextGreaterElements(vector& v) { vector vans; int n = v.size(); stack st; for(int i=n-1;i>=0;i--) st.push(v[i]); for(int i=n-1;i>=0;i--) { while(!st.empty() and st.top()
@akshaykenjale2642
@akshaykenjale2642 2 жыл бұрын
In Next Greater Elements problem I guess instead of i
@PIYUSH-lz1zq
@PIYUSH-lz1zq 2 жыл бұрын
for first variant why we running for 2*n-1 ... it should be done only for circular onces !!
@amanbhadani8840
@amanbhadani8840 2 жыл бұрын
@@PIYUSH-lz1zq Not required for first variant bro.
@spandanrastogi7144
@spandanrastogi7144 2 жыл бұрын
Awesome explanation ! In Code, I think by mistake Loop is iterating from left to right when it should be iterating from right to left.
@sypher4735
@sypher4735 2 жыл бұрын
Yes, you're right, but he actually mentioned it in the comment.
@spandanrastogi7144
@spandanrastogi7144 2 жыл бұрын
Didn't saw that
@maccall0108
@maccall0108 3 жыл бұрын
brother we can also store array index from n-2 to 0 in stack and then apply the similer logic as we have applied in Ques ->next-greater element -I and before returning our vector we just need to reverse it. vectorv; stacks; int siz=nums.size(); for(int i=siz-2;i>=0;i--) { s.push(nums[i]); //store from n-2 to 0 in stack } for(int i=siz-1;i>=0;i--) { if(s.empty()==1) { s.push(nums[i]); v.push_back(-1); } else { while(s.empty()!=1 && (s.top()
@somratdutta
@somratdutta 3 жыл бұрын
I wish we had such teachers! 😢😍
@udayptp
@udayptp 3 жыл бұрын
Bhai kal hi mere coding round mein ye question pucha tha, 1- next greater element 2- make largest no using all element of the array
@chandankumarshaw216
@chandankumarshaw216 3 жыл бұрын
which company
@udayptp
@udayptp 3 жыл бұрын
@@chandankumarshaw216 Thinkitive technologies
@udayptp
@udayptp 3 жыл бұрын
@@chandankumarshaw216 package 4.5lpa
@Carson00_11
@Carson00_11 8 ай бұрын
@@udayptp bhai abhe kya kar rhe ho
@udayptp
@udayptp 8 ай бұрын
@@Carson00_11 D. E. Shaw and Co.
@ineerajnishad
@ineerajnishad 2 жыл бұрын
Maaannn, Striver you're certainly best in what you do, which is TEACH things so so smoothly! Big thanks Sir❤
@rishabhkumar8115
@rishabhkumar8115 3 жыл бұрын
bro hats off to you...you have brought this new institution for circular array..Before this I don't about this. Thankx to be our menntor
@protyaybanerjee5051
@protyaybanerjee5051 Жыл бұрын
Concept - Monotonic Stack. Here we are using Monotonically Decreasing stack
@snehilsinha4689
@snehilsinha4689 3 жыл бұрын
Best possible explanation! The concept gets stuck in my mind forever after watching this 🔥. tysm striver bhaiya 💓
@onlygaming24-h7d
@onlygaming24-h7d Жыл бұрын
i was at dp 55 i was suggested to watch largest rectangle in histogram and there i was suggested to watch first the next greater element so this is how i am here. Now i will watch this then i will again go to largest rectangle in histogram and then where i was originally exactly to DP 55
@ayush_Bhagat129
@ayush_Bhagat129 5 ай бұрын
class Solution { public: vector nextGreaterElements(vector& nums) { int n = nums.size(); stack st; vector Nge(n, -1); for (int i = 2 * n - 1; i >= 0; i--) { while (!st.empty() && st.top()
@stormwalker1130
@stormwalker1130 3 жыл бұрын
Watched your n queen and sudoku problem,the explanation was awesome.
@humble.660
@humble.660 2 жыл бұрын
CODE in Python: class Solution: def nextGreaterElements(self, nums: List[int]) -> List[int]: res = [-1] * len(nums) n = len(nums) stack = [] for i in range(2 * len(nums) - 1, - 1, - 1): while stack and nums[i % n] >= stack[-1]: stack.pop() if stack: res[i % n] = stack[-1] stack.append(nums[i % n]) return res
@vishnupandey3390
@vishnupandey3390 Жыл бұрын
thanks man it really helped me 🙏
@gowthamarun43
@gowthamarun43 3 жыл бұрын
we can try the same logic by traversing from the end also like normal array variant
@omkarsk98
@omkarsk98 Жыл бұрын
Excellently explained why removing the element wont affect the solution for previous elements
@adarshbadagala
@adarshbadagala 3 жыл бұрын
Thank you so much for such an excellent explanation but I have small doubt instead of writing an if condition inside loop can we just use i%n for nge too? i mean instead of writing if(i
@JujareVinayak
@JujareVinayak 2 жыл бұрын
Yes
@arjunrai8126
@arjunrai8126 2 жыл бұрын
Yes u can
@AbhishekKumar-vr7sh
@AbhishekKumar-vr7sh 2 жыл бұрын
U can and it will still pass the test cases but its not needed bcoz anyways its gonna get replaced when we process elements in range i = 0 to n-1
@adarshbadagala
@adarshbadagala 2 жыл бұрын
@@AbhishekKumar-vr7sh thank you for clarifying
@karanthakkar9009
@karanthakkar9009 3 жыл бұрын
Hii bhaiya, recently I came into a problem called "Sherlock and the maze" tags: memorization & DP. I really did not understood how to slove problem, when I saw the editorial it was really confusing, I also saw other's people submission, but everyone had submitted in scala,haskell language. Could you make a video on that problem?
@cricedge4454
@cricedge4454 2 жыл бұрын
bhai for(i=2*n-1 .......) hoga ..but u have written for(i=0..)
@vitaminprotein2217
@vitaminprotein2217 2 жыл бұрын
leetcode 1019 cpp sol:(of linkedlist) vectorans; stackst; //convert the LL in ans(array/vector) while(head){ ans.push_back(head->val); head=head->next; } //now it became a normal array q for(int i=ans.size()-1;i>=0;i--){ while(!st.empty() && st.top()=0;i--){ while(!st.empty() && st.top()
@ashwanisingh1135
@ashwanisingh1135 3 жыл бұрын
saw the title , went to solve the problem and then came back here to see the best approach
@swaroopchakraborty3488
@swaroopchakraborty3488 2 жыл бұрын
Great tutorial Striver. God bless you. I tried optimizing the solution for circular structure a little bit more if array lengths are short (n 0 && n != arr.length) { return null; } int[] nge = new int[1]; if (arr.length > 0 && arr.length < 2) { nge[0] = -1; return nge; } if (arr.length == 2) { nge = new int[2]; if (arr[0] < arr[1]) { nge[0] = arr[1]; nge[1] = -1; } else { nge[0] = -1; nge[1] = arr[0]; } return nge; } // The Stacking Algorithm will work only if there are more than 2 elements in // array. This is // done for reducing space and time complexity for arrays which are less than // n=2 in length or are relatively small. nge = new int[n]; Stack st = new Stack(); // Circular array implementation 2n-1 for (int i = 0; i < 2 * n - 1; i++) { // n-1 while (!st.empty() && st.firstElement()
@anubhavsingh8144
@anubhavsingh8144 3 жыл бұрын
Great work bhaiya I have a request to make bhaiya Pls make a video on "Find K closest elements" Using Binary Search.. Leetcode: 658
@chetanraghavv
@chetanraghavv 2 жыл бұрын
class Solution { public: vector findClosestElements(vector& arr, int k, int x) { int n = arr.size(); if(n == 1) return arr; vector res; int start = 0, end = n-1, mid=0; while(start =0 && end=0) //means end pointer is exhausted, select elements from start in this case { res.push_back(arr[start]); start--; k--; } while(k>0 && end
@AishwarysinghEC
@AishwarysinghEC Жыл бұрын
why(i
@Rituresh
@Rituresh 3 жыл бұрын
bhaiya aaj ya question smajh mai aa gaya aapki viddeo sai.you are doing good eork
@bhaveshkumar6842
@bhaveshkumar6842 3 жыл бұрын
Thank you, Striver!!! You're the best!!
@Anonymous-uj3jx
@Anonymous-uj3jx 2 жыл бұрын
Hello Striver! Thanks for all your videos. Can you please upload a video on the problem "Sort A Stack" which is in SDE sheet. It is really tough to understand😢
@athxrva_n
@athxrva_n Жыл бұрын
yeah man babbar had taught it with recusion but i did'nt understand the whole recursion properly
@ayeshasumaiya8280
@ayeshasumaiya8280 2 жыл бұрын
Very clear and detailed explanation I thought my brain cannot understand the logic behind this simple problem but your explanation made it crystal clear
@stith_pragya
@stith_pragya Жыл бұрын
Thank You So Much Striver Brother.....🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
@pryansh_
@pryansh_ Жыл бұрын
you are the best on YT..
@rakib_8feb
@rakib_8feb Жыл бұрын
13:10 Circular Array
@adityasethi9794
@adityasethi9794 Жыл бұрын
I think code has an error. Why do we start form left and go till right. Aren't we supposed to start from end and do i-- ?
@kamleshjoshi2949
@kamleshjoshi2949 2 жыл бұрын
Waah jo doubt aya whi btadiya 😅 OP 🔥🔥
@AshishKumar-pq6pr
@AshishKumar-pq6pr 3 жыл бұрын
Awesome lecture bhaiya
@BRSanush
@BRSanush 2 жыл бұрын
Wow what an explaination. Thank you striver.
@ronakslibrary8635
@ronakslibrary8635 Жыл бұрын
Thanks sir for explaining this concept , the use of Stack is improvinzing the efficiency of solution by lot
@ritesh1211
@ritesh1211 Жыл бұрын
int n = arr.size(); vectorans(n,-1); stackstk; //dec to find next greater for(int i=0;iarr[stk.top()]){ int poped = stk.top(); ans[poped]=arr[i%n]; stk.pop(); } stk.push(i%n); //pushing indexs } return ans;
@swastikkumarpal7795
@swastikkumarpal7795 2 жыл бұрын
bhaiya there is something wrong in the for condition ...it should start iterating from backward
@selvaragavan_10
@selvaragavan_10 Жыл бұрын
Bro you're starting from zero and how does it checks the next greater element???
@LifeGoing
@LifeGoing 3 жыл бұрын
There is no doubt that your explanation is awesome.but it would much better if you will show code in code editor.
@takeUforward
@takeUforward 3 жыл бұрын
Okay lets try that
@LifeGoing
@LifeGoing 3 жыл бұрын
@@takeUforward hopefully it will be more understandable 😍
@doctordsa8669
@doctordsa8669 8 ай бұрын
This is one of the best videos I have watched on the internet
@Chhooso
@Chhooso 9 ай бұрын
im dry running so times but still didnt understand how that code works under circular condition it will work without that condition and in coding ninjas too that condition is not mentioned ig idk y whenever i start from the end i just get it -1 after dry running and the rest is correct
@Chhooso
@Chhooso 9 ай бұрын
my bad got it...never doubt striver
@ApnaVlogs-tj7do
@ApnaVlogs-tj7do Жыл бұрын
Wonderful explanation bhaiya
@MyPathUnveiledYT
@MyPathUnveiledYT 9 ай бұрын
in circular array method i think answer should be like 10 12 -1 11 -1 not 10 12 --1 11 -1
@suryapriya1953
@suryapriya1953 11 ай бұрын
Bro please teach us with a small example with 11 elements . it ll be efficient to understand to beginners with 5 to 6 elements.
@pankajkumarshukla9253
@pankajkumarshukla9253 Жыл бұрын
Your teaching ability is awesome ,bro keep it up.
@varun1017
@varun1017 9 ай бұрын
16:40 I think iteration should be done in reverse order. forward is not working for me.
@rohith8269
@rohith8269 Жыл бұрын
Greeeaaaaaaattt explanation!!!! Thankyou so much
@whatthecode7219
@whatthecode7219 3 жыл бұрын
Solved this question 2 days back, nonetheless, enjoyed the explanation :)
@surajsah3361
@surajsah3361 Жыл бұрын
in explanation you iterate from index of last element and in code you are itterating from starting element?
@SatyamKumar-bw4vi
@SatyamKumar-bw4vi 2 жыл бұрын
Hare Krishna!
@PIYUSH-lz1zq
@PIYUSH-lz1zq 2 жыл бұрын
for first variant why we running for 2*n-1 ... it should be done only for circular onces !!
@gauravmutha2536
@gauravmutha2536 2 жыл бұрын
@@PIYUSH-lz1zq Did you get the answer,I too am facing same problem.
@shrikantsharma8933
@shrikantsharma8933 2 жыл бұрын
Hi, I really like your videos, just 1 question, which software or tool you are using to put these small animations on prerecorded videos?
@anurondas3853
@anurondas3853 Жыл бұрын
Man... Guys stop paying thousand of rupees for learning to code!! Striver over here does it better than any and all of them! Really great video.😆😁
@amandubey5287
@amandubey5287 2 жыл бұрын
This is just amazing and very well explained. Thanks
@LaxmiTeja-c2f
@LaxmiTeja-c2f Жыл бұрын
You are a saviour!!
@franciskp9117
@franciskp9117 9 ай бұрын
Bro In the first few minutes of the video you are iterating the array from right to left, but when the sudo code is shown, you start 'i' from 0 and go till 2n-1. Isn't this the other way around ? Like shouldn't 'i' start from 2n-1 and end at i >= 0. Correct me if I'm wrong.
@dpxy1599
@dpxy1599 Жыл бұрын
nicely explained
@amanbhadani8840
@amanbhadani8840 2 жыл бұрын
Amazing explanation !!
@utkarshgupta3869
@utkarshgupta3869 3 жыл бұрын
Hello bhaiya, I have one question... please reply... I am a B.Sc(c.s) Student. Please help me to know can I get a job(above 5 lpa) after my Graduation. I learnt enough C++ and completed DSA and going to start web development and also 3 star at codechef. I can learn anything for job after Graduation. Please help to me tell that can I get or I have to do MCA.
@Sarojkumar-yh9uy
@Sarojkumar-yh9uy 3 жыл бұрын
Just start applying to relevant job openings
@aniketpandey1913
@aniketpandey1913 Жыл бұрын
Hi Guys, problem : find next greater element to the right in array Solution: we use stack for solving this Doubt : some people prefer to store indices rather than the actual element in the stack can someone pls explain why the first approach is better than the other. One advantage i can think of is that in case of storing indices we save space
@DR-mq1le
@DR-mq1le Жыл бұрын
doesnt matter since integer will anyways take the same space(as indices and elements both are int type) , if say the elements were some other bigger data type than int , then it would make sense storing indices , but then also negligible difference would be there
@bhagirathmakwana9112
@bhagirathmakwana9112 Жыл бұрын
my brother u are great
@securelyinsaycure
@securelyinsaycure 8 ай бұрын
Smooth like butter 🧈
@raghavendrasoni6712
@raghavendrasoni6712 2 жыл бұрын
great explanation man!
@abinvarkey2331
@abinvarkey2331 Жыл бұрын
best video on the topic i could find!
@satyampande684
@satyampande684 3 жыл бұрын
understood!!
@Shubham-zl1zb
@Shubham-zl1zb 7 ай бұрын
Thank you
@111rhishishranjan2
@111rhishishranjan2 Жыл бұрын
I didn't get that why you used circular array and made the solution difficuilt to understand . mean normal array also work well i guess.If anyone understood it , kindly explain me too , //Here is my code #include using namespace std; vector nextGreaterElement(vector v){ int n=v.size(); vectorarr1(n,0) ; stacks; for(int i=n-1;i>=0;i--){ //int currentprice=v[i]; while(!s.empty() and s.top()
@srinathchembolu7691
@srinathchembolu7691 Жыл бұрын
he explained a total of 2 questions. The circular array one is next greater element II on leetcode
@gaganeshmahajan7198
@gaganeshmahajan7198 Жыл бұрын
Can someone please explain why he took the loop till 2n-1?? I didnt understand..Please help..
@adarshrai9516
@adarshrai9516 3 жыл бұрын
Thanks bro ❤️
@samjackson4982
@samjackson4982 Жыл бұрын
can anyone answer, why we are going through the array in reverse order? what is the intuition?
@chaitanyakumar9229
@chaitanyakumar9229 3 жыл бұрын
no yaar 😂😂
@igaming_
@igaming_ 2 жыл бұрын
We have to make i%n for every i except for for loop Am I right guuys reply...
@KoushikVarma-h1b
@KoushikVarma-h1b 2 жыл бұрын
Next greater element for 7 is 10 not -1. 3:47
@alexmercerind
@alexmercerind 2 жыл бұрын
modulo logic is cool
@sidarthroy815
@sidarthroy815 2 жыл бұрын
so after i>n there will be empty iteration(with just pushing nd poping in stack) for rest half till it reaches 2n-1?
@amanbhadani8840
@amanbhadani8840 2 жыл бұрын
Yes,basically for i>=n its just pushing and popping,but this step will ensure that if there is any element greater than last index element present on the left side,it will be already there in stack. And for i
@Learnprogramming-q7f
@Learnprogramming-q7f 8 ай бұрын
Thank you Bhaiya
@leepakshiyadav1643
@leepakshiyadav1643 2 жыл бұрын
Excellent explanation :)
@shubhamgupta9778
@shubhamgupta9778 3 жыл бұрын
Thank u bro.... Your video always give us very good concept..... Please make a session on josephus problem. This problem is very easy to understand but hard to implement.
@damandeepsingh6037
@damandeepsingh6037 2 жыл бұрын
great explanantion
@googlysahoo1397
@googlysahoo1397 3 жыл бұрын
For the first variant, the size of the array will be n then why and how we will take 2n-1?? Though for 2nd variant we are copying the elements(imaginary) we will assume the size to be 2n-1 but not in the first case. Could anyone explain the reason??
@takeUforward
@takeUforward 3 жыл бұрын
In first case, we don’t have the circular array concept. If there does not exists on right, its -1
@googlysahoo1397
@googlysahoo1397 3 жыл бұрын
My doubt is why to run the loop from 0 to 2n-1 where the size of the array is n? for(int i = 2n-1; i >= 0; i++) // this line
@ritishgupta2982
@ritishgupta2982 3 жыл бұрын
@@googlysahoo1397 do i--
@gauravmutha2536
@gauravmutha2536 2 жыл бұрын
Did you get your answer?
@shivamehta6537
@shivamehta6537 3 жыл бұрын
Awesome👍
@abhaysharma4065
@abhaysharma4065 3 ай бұрын
Thanks sir 😊
@MuhammadFahreza
@MuhammadFahreza 3 ай бұрын
what is the time complexity on 12:16? Thanks!
@youtubeuserlovesyoutube2207
@youtubeuserlovesyoutube2207 4 ай бұрын
striver bro the loop cond should be for (int i = (len * 2) - 1; i >= 0; i--) Isn't it>?
@sp_9467
@sp_9467 4 ай бұрын
Yes you are right
@kainathussain6973
@kainathussain6973 2 жыл бұрын
god level explaination🤩😍
@umangjaiswal7448
@umangjaiswal7448 Жыл бұрын
for circular , can we use upper_bound to solve problem ??
@gauravmehra8189
@gauravmehra8189 Жыл бұрын
did you find the answer to your question? can we use upper_bound for circular?
@mohithguptakorangi1766
@mohithguptakorangi1766 3 жыл бұрын
ok, so you have written the code wrong?? cause i=2n-1 should be the initialized, I've been cracking my head
@takeUforward
@takeUforward 3 жыл бұрын
Please watch the video completely… i%n has been used.. no need to initialize..
@mohithguptakorangi1766
@mohithguptakorangi1766 3 жыл бұрын
@@takeUforward I meant (i=2n-1; i>=0;i--) the way you wrote in github code.....OR both are correct?
@takeUforward
@takeUforward 3 жыл бұрын
Oops, my bad.. github is correct!
@mohithguptakorangi1766
@mohithguptakorangi1766 3 жыл бұрын
@@takeUforward Ok cool....I watch your videos completely see?? so I'm getting better than you haha. Have a good day
@takeUforward
@takeUforward 3 жыл бұрын
@@mohithguptakorangi1766 haha, actually while writing code, i need to explain, see in camera, hence concentration XD
@JosepJeev
@JosepJeev Жыл бұрын
Shdnt i be as I=2*n-1 instead of i=0
@yeswanthh5068
@yeswanthh5068 2 жыл бұрын
Understood sir
@aryanchauhan8066
@aryanchauhan8066 3 жыл бұрын
nice concept
@abd6406
@abd6406 Жыл бұрын
"for' loop will be on reverse
@rgvhere
@rgvhere 2 ай бұрын
u watch showing time 3:23 bro
@sivaganesh4489
@sivaganesh4489 2 жыл бұрын
initially i worried about the run time of the video. after watching the video, i enjoyed every second of it. really great explanation dude.
@PIYUSH-lz1zq
@PIYUSH-lz1zq 2 жыл бұрын
for first variant why we running for 2*n-1 ... it should be done only for circular onces !!
@amanbhadani8840
@amanbhadani8840 2 жыл бұрын
@@PIYUSH-lz1zq yes
@shubham6215
@shubham6215 3 жыл бұрын
Thanks 🤩
Implement LRU Cache | Leetcode
17:05
take U forward
Рет қаралды 280 М.
L5. Next Greater Element | Stack and Queue Playlist
18:25
take U forward
Рет қаралды 63 М.
Do you love Blackpink?🖤🩷
00:23
Karina
Рет қаралды 21 МЛН
Thank you Santa
00:13
Nadir Show
Рет қаралды 35 МЛН
Next Greater Element I - Leetcode 496 - Python
14:53
NeetCode
Рет қаралды 79 М.
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 835 М.
Beginners Should Think Differently When Writing Golang
11:35
Anthony GG
Рет қаралды 124 М.
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
ThePrimeTime
Рет қаралды 740 М.
Next Permutation - Intuition in Detail 🔥 | Brute to Optimal
28:15
take U forward
Рет қаралды 459 М.
L6. Next Greater Element - II | Stack and Queue Playlist
15:41
take U forward
Рет қаралды 41 М.