The above solution does not work for testcase [10 ,10, 10 10] expected result would be [1,1,1,1] but above solution will give [1,2,3,4]..and it is wrong..
@nafisaslam6267 Жыл бұрын
just remove the equal to sign from the while loop condition. Thats it :)
@nikoo28 Жыл бұрын
Thanks for pointing this out. I have fixed the solution on the Github link, also added your particular test case. Thanks for the contribution. :)
@ajay.246111 ай бұрын
acually the
@VANAPARTHIBULLISIVABCE10 ай бұрын
@@nikoo28 Sir, I think your code is correct .There is no need to remove equal sign because we consider the values which are equal or less than the current value. If we have to choose the values that are strictly less than ,then we need to remove .so for 10 10 10 10 the output will be 1 2 3 4 only.
@shraddhajain89353 жыл бұрын
Please keep uploading the videos. I get the best Explaination/ solutions / answers on this channel. 👍🏻
@rajenshrestha87952 жыл бұрын
Wow, I finally got the idea after watching your explanation, thank you so much!
@monismomin675911 ай бұрын
Thank you so much!! I was searching for the question, but I was not able to understand the intuition from others' videos. I got intuition because of you!!
@nikoo2811 ай бұрын
that is so great to hear
@elasingh31513 жыл бұрын
Please upload more leetcode problems! Your explanation is really great :)
@rachitchaddha999 Жыл бұрын
ur way of explaining question is really nice and interesting
@japneetkaur7095 Жыл бұрын
amazing explanation...thank you for this!!
@iii7317 Жыл бұрын
You providing more better than UDEMY . Concept 100% ... UPLOAD = RESPECT
@nikoo28 Жыл бұрын
Please share these videos as much as you can with your peers. It keeps me motivated and youtube would also promote them automatically then.
@taherkp73213 жыл бұрын
Great Explanation
@SwadeepChavanАй бұрын
thank your nikhil great explanation, please make video on sliding window maximum
@rohitsaka3 жыл бұрын
Thank you so much brother .. means a lot ! 😊
@nikoo283 жыл бұрын
Always welcome mate. Fans like you are always a support 😄
@Jaylight977 Жыл бұрын
@@nikoo28 bhaiya really ,your explanation skill is next level ,love u . one day i wanna a meet u 😆😆
Understood the solution but one doubt:- How the time complexity is O(n). Worst case scenario is like for ith element you might have to iterate over and remove all elements of the stack till last element. That way it will be O(n^2). One possible example can be like if input array is ascending order. If this understanding is correct, then is there a diff between brute force and stack based solution ?
@nafisaslam6267 Жыл бұрын
Being experienced, you should have handled the case for equal values in array too. Your solution is INCORRECT. Remove the equal to sign and you're good to go.
@nikoo28 Жыл бұрын
Apologies for the miss, I have fixed it on the github link.
@MyselfTheodore Жыл бұрын
Thank you
@RoshanSingh-kj4fy17 күн бұрын
tq
@Priyansh_Garg156 ай бұрын
thanku
@pratibhajaiswal96653 жыл бұрын
What is the time complexity of the efficient solution?
@nikoo283 жыл бұрын
That would be O(n) as you are only traversing the array once.
@pratibhajaiswal96653 жыл бұрын
@@nikoo28 Thanks :)
@sksabir80636 ай бұрын
wow😊
@rajesht8157 Жыл бұрын
Where can i get a text based version of this video explanation ?
@nikoo28 Жыл бұрын
I haven't created it yet.
@rajesht8157 Жыл бұрын
@@nikoo28 A small request😊 If it possible to create the same Also, for the recent I don't see a text based version If possible can you create for them too
@AmitKumar-cp1oz5 күн бұрын
but the leetcode have different format for the solution.
@nikoo285 күн бұрын
check out the code on github (link in description), it has the full code with the same leetcode format. The video goes over the core logic.
@vaibhavsharma76302 жыл бұрын
we want a faster solution , time limit is exceeding .
@nikoo282 жыл бұрын
Check the link in the description…it has the complete solution with all test cases
@vaibhavsharma76302 жыл бұрын
My mistake , this is the fastest way . They have some compiler issue