Skip to content

feat: Add MinStackUsingTwoStacks new algorithm with Junit tests #5758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 15, 2024

Conversation

Hardvan
Copy link
Contributor

@Hardvan Hardvan commented Oct 13, 2024

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

@Hardvan Hardvan changed the title feat: Add MinStackUsingTwoStacks new algorithm with Junit tests feat: Add MinStackUsingTwoStacks new algorithm with Junit tests Oct 13, 2024
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.

Project coverage is 63.98%. Comparing base (6682c7c) to head (cdc4952).

Files with missing lines Patch % Lines
...m/thealgorithms/stacks/MinStackUsingTwoStacks.java 84.61% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5758      +/-   ##
============================================
+ Coverage     63.96%   63.98%   +0.01%     
- Complexity     4172     4178       +6     
============================================
  Files           583      584       +1     
  Lines         16320    16333      +13     
  Branches       3150     3151       +1     
============================================
+ Hits          10439    10450      +11     
- Misses         5456     5457       +1     
- Partials        425      426       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Hardvan Hardvan marked this pull request as ready for review October 13, 2024 07:20
@alxkm
Copy link
Contributor

alxkm commented Oct 13, 2024

This contribution looks like from leetcode. And according to rules, could you please provide any sources that describe that this is not from leetcode or similar resources.

@Hardvan
Copy link
Contributor Author

Hardvan commented Oct 14, 2024

The MinStackUsingTwoStacks algorithm is a widely known solution in data structures, frequently discussed in programming interviews and textbooks. It is not exclusive to LeetCode but is a classic problem in designing a stack that supports push(), pop(), and retrieving the minimum element in constant time using two stacks—one to store the elements and the other to track the minimum values. You can find similar implementations and discussions on several well-known platforms, such as GeeksforGeeks and Stack Overflow, as well as in books like Cracking the Coding Interview.

This problem is a common way to assess problem-solving skills and understanding of space-time trade-offs in interviews and is thus not tied to any single platform.

alxkm
alxkm previously approved these changes Oct 14, 2024
@siriak siriak merged commit 776946e into TheAlgorithms:master Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants