Skip to content

Conversation

@krishnakamalbaishnab
Copy link

@krishnakamalbaishnab krishnakamalbaishnab commented Feb 3, 2026

Summary of Changes

This PR resolves GitHub issue #7253: "Clean up duplicate Java algorithm implementations".

Changes include:

  1. ValidParentheses: merged stacks implementation, removed duplicate strings version, updated tests.
  2. LongestPalindromicSubstring: merged brute-force and DP implementations, removed duplicate DP version, updated tests.
  3. HammingDistance: merged string, integer, and binary implementations; removed duplicates; updated tests.
  4. BoyerMoore: renamed to BoyerMooreMajorityVote to distinguish from string search version; updated tests.
  5. CoinChange: renamed greedy version to GreedyCoinChange; updated tests.
  6. DIRECTORY.md: updated entries for all consolidated files.

All tests for the modified packages pass; unrelated pre-existing test failures remain unchanged.


  • 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 algorithms include a corresponding test class that validates their functionality.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 88.23529% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.35%. Comparing base (3e36833) to head (5174aeb).

Files with missing lines Patch % Lines
...ava/com/thealgorithms/strings/HammingDistance.java 75.00% 2 Missing and 2 partials ⚠️
...ava/com/thealgorithms/stacks/ValidParentheses.java 85.71% 0 Missing and 1 partial ⚠️
...lgorithms/strings/LongestPalindromicSubstring.java 95.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7255      +/-   ##
============================================
- Coverage     79.38%   79.35%   -0.03%     
+ Complexity     7017     7009       -8     
============================================
  Files           785      781       -4     
  Lines         22982    22969      -13     
  Branches       4520     4518       -2     
============================================
- Hits          18244    18228      -16     
- Misses         4017     4018       +1     
- Partials        721      723       +2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@krishnakamalbaishnab
Copy link
Author

The modified files in this PR pass all tests locally and are already properly formatted according to the repository's clang-format style.
Any linter/build failures in CI are pre-existing issues unrelated to this cleanup.

@DenizAltunkapan
Copy link
Member

@krishnakamalbaishnab The CI failures are not pre-existing.

The current workflow failures are directly caused by changes in this PR. Specifically, the clang-format reformatting modified test files in a way that introduces a Checkstyle violation (e.g. an unused import in ValidParenthesesTest.java).

As a result, the statement that all linter/build failures are unrelated to this cleanup is incorrect—the failures are reproducible in CI and stem from the changes introduced here.

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.

3 participants