good explanation but I dont think map will work in this case because the nums array contains duplicates and same numbers may have different next greater elements
@avneetsng4 жыл бұрын
the moment you said we will push index , solution clicked my mind . Thanks man
@Ben-pb7ct3 жыл бұрын
What is the reason we push i to the stack in the condition if(i < n) ?
@ritik79068 ай бұрын
u are accessing(arr[i]) in that part
@jyothi90825 ай бұрын
Thanks buddy! LC solution was incomprehensible
@DEEPAKGOYALnullRA4 жыл бұрын
solution is too much confusing i got but still ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@shritishaw75103 жыл бұрын
vector nextGreaterElements(vector& v) { vector res; int n = v.size(); for(int j = 0;j
@ahmetokur69834 жыл бұрын
Dude, I forgot everything I learnt so far😁
@anmolkarki52483 жыл бұрын
haha. just have more practice you will get it.
@sohamdharap4789 Жыл бұрын
i can feel you! same happened with me when i tried to implement this solution on my own😮💨
@shritishaw75103 жыл бұрын
2:29 clicked me, thanks a lot pal
@ericnatelson28393 жыл бұрын
8:07 is where it clicked for me
@sydneystriker53553 жыл бұрын
Man. This problem is so hard not intuitive. Anyway thanks for the clear explanation.
@rjkal2 жыл бұрын
You could’ve explained with a diagram first and then jumped to the code. Then you wouldn’t have had such a hard time explaining the code with all the indices.
@lonelygirlz4 жыл бұрын
looks similar to shift problem (A+A) contains B
@stone89054 жыл бұрын
Good. Thanks how many hours did you spend to this problem?
@jugsma66764 жыл бұрын
20 minutes
@farazahmed72 жыл бұрын
@@jugsma6676 Ding Dong Ling Long Steve Cold Ayeeeeeeee