feat: add StockSpanProblem algorithm#7312
feat: add StockSpanProblem algorithm#7312oleksii-tumanov wants to merge 2 commits intoTheAlgorithms:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7312 +/- ##
============================================
+ Coverage 79.43% 79.45% +0.02%
- Complexity 7062 7070 +8
============================================
Files 788 789 +1
Lines 23124 23134 +10
Branches 4545 4548 +3
============================================
+ Hits 18368 18381 +13
+ Misses 4022 4021 -1
+ Partials 734 732 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
e2ece88 to
105aae5
Compare
|
Looks good. Consider adding comments for better readability. |
105aae5 to
af047b0
Compare
more comments added |
Nice implementation. Adding inline comments would make it easier for beginners to understand the logic. |
Can you check StockSpanProblem.java implementation please? I have comments for each code line already. |
The implementation looks clean and well-structured, and the inline comments are helpful for understanding the logic. You might consider adding:
Overall, great work! |
Thank you Abhiram. Other info like description and example already in place. |
Glad to hear that! The implementation looks great now. Thanks for the update. |
clang-format -i --style=file path/to/your/file.javaDescription
Adds a monotonic-stack implementation of the Stock Span Problem.
The implementation:
Closes #7311
Test Case
Validated with:
[10, 4, 5, 90, 120, 80] -> [1, 1, 2, 4, 5, 1]IllegalArgumentExceptionCommands used:
mvn -Dtest=StockSpanProblemTest testmvn -DskipTests checkstyle:check