Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add MaxAlternatingSum algorithm implementation #7085

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

Open
Jashnavi25 wants to merge 3 commits into TheAlgorithms:master
base: master
Choose a base branch
Loading
from Jashnavi25:add-leetcode-solution

Conversation

@Jashnavi25
Copy link

@Jashnavi25 Jashnavi25 commented Nov 20, 2025

This PR adds a Java implementation of Max Alternating Sum to the devutils package.

Includes:
✔ Javadoc documentation
✔ Clean formatting and package declaration
✔ Sorting + arithmetic based optimal algorithm
✔ Follows TheAlgorithms conventions

Time Complexity: O(n log n)
Space Complexity: O(n)

Refactored maxAlternatingSum method to use squared values and improved variable naming.
Copy link

codecov-commenter commented Nov 20, 2025
edited
Loading

Codecov Report

❌ Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.44%. Comparing base (fa8ea8e) to head (3e1a4b2).

Files with missing lines Patch % Lines
.../com/thealgorithms/devutils/MaxAlternatingSum.java 0.00% 14 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@
## master #7085 +/- ##
============================================
- Coverage 78.50% 78.44% -0.06% 
+ Complexity 6752 6750 -2 
============================================
 Files 759 760 +1 
 Lines 22402 22416 +14 
 Branches 4400 4403 +3 
============================================
- Hits 17587 17585 -2 
- Misses 4109 4123 +14 
- Partials 706 708 +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.

Copy link
Author

Hi maintainers 👋

This PR adds a new algorithm MaxAlternatingSum to the devutils package,
with documentation and proper formatting.

All checks passed successfully ✔️

Kindly review when you get time.
Thank you! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@DenizAltunkapan DenizAltunkapan Awaiting requested review from DenizAltunkapan DenizAltunkapan is a code owner

@yanglbme yanglbme Awaiting requested review from yanglbme yanglbme is a code owner

@alxkm alxkm Awaiting requested review from alxkm alxkm is a code owner

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /