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..
@@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.
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!!
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.
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 ?
@@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
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..
just remove the equal to sign from the while loop condition. Thats it :)
Thanks for pointing this out. I have fixed the solution on the Github link, also added your particular test case. Thanks for the contribution. :)
acually the
@@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.
Please keep uploading the videos. I get the best Explaination/ solutions / answers on this channel. 👍🏻
Wow, I finally got the idea after watching your explanation, thank you so much!
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!!
that is so great to hear
Please upload more leetcode problems! Your explanation is really great :)
ur way of explaining question is really nice and interesting
amazing explanation...thank you for this!!
You providing more better than UDEMY . Concept 100% ... UPLOAD = RESPECT
Please share these videos as much as you can with your peers. It keeps me motivated and youtube would also promote them automatically then.
Great Explanation
thank your nikhil great explanation, please make video on sliding window maximum
Thank you so much brother .. means a lot ! 😊
Always welcome mate. Fans like you are always a support 😄
@@nikoo28 bhaiya really ,your explanation skill is next level ,love u . one day i wanna a meet u 😆😆
@@Jaylight977 one day... 😄
Excellent explanation sir... keep uploading videos....
Keep watching
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.
Apologies for the miss, I have fixed it on the github link.
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 ?
красавчик, отлично объясняешь!
Thanks great video
What is the time complexity of the efficient solution?
That would be O(n) as you are only traversing the array once.
@@nikoo28 Thanks :)
Where can i get a text based version of this video explanation ?
I haven't created it yet.
@@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
op solution bhaii!
Thank you
tq
thanku
wow😊
we want a faster solution , time limit is exceeding .
Check the link in the description…it has the complete solution with all test cases
My mistake , this is the fastest way . They have some compiler issue
Plll