Adds solution for LeetCode Daily Challenge on 10 October in C++.
To solve this problem I have used monotonic stack, i have taken all the elements from the left in a stack such that they follow this pattern i.e. nums[j]<stack.top() and after making this stack, i have started from right to start poping elements from the stack if they follow this condition i.e nums[j]>=stack.top(), if they do follow these condition then i pop that element from stack and also calculate j-i for that instance.
π Issue Reference:
Fixes issue: # 10
π Checklist:
Please ensure the following before submitting your PR:
[ ] I have placed my solution in the correct folder (solutions/dayXX/).
[T] My code follows clean coding practices and is efficient.
[ ] I have added comments in my code to explain the approach.
[ ] I have updated the README.md for the specific day with a brief explanation of my solution.
[T] I have tested the solution on LeetCode and it works correctly.
π What does this PR do?
π Issue Reference:
Fixes issue: # 10
π Checklist:
Please ensure the following before submitting your PR:
solutions/dayXX/
).README.md
for the specific day with a brief explanation of my solution.π§ Solution Details:
π Additional Notes (if any):
Screenshot of above Solution