Skip to content

fix: reject negative input in SumOfSquares and add tests#7543

Merged
alxkm merged 2 commits into
TheAlgorithms:masterfrom
lieutenant-Rohit:fix-sumofsquares-negative-input
Jul 26, 2026
Merged

fix: reject negative input in SumOfSquares and add tests#7543
alxkm merged 2 commits into
TheAlgorithms:masterfrom
lieutenant-Rohit:fix-sumofsquares-negative-input

Conversation

@lieutenant-Rohit

@lieutenant-Rohit lieutenant-Rohit commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Fixes #7538

  • Added input validation to throw IllegalArgumentException for negative values.

  • Updated unit tests to confirm behavior.

  • 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

codecov-commenter commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.31%. Comparing base (af9aad3) to head (3158629).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7543      +/-   ##
============================================
- Coverage     80.32%   80.31%   -0.01%     
+ Complexity     7406     7405       -1     
============================================
  Files           812      812              
  Lines         23914    23916       +2     
  Branches       4706     4707       +1     
============================================
  Hits          19208    19208              
  Misses         3945     3945              
- Partials        761      763       +2     

☔ View full report in Codecov by Harness.
📢 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.

@lieutenant-Rohit
lieutenant-Rohit marked this pull request as draft July 26, 2026 01:50
@lieutenant-Rohit
lieutenant-Rohit marked this pull request as ready for review July 26, 2026 01:50
@lieutenant-Rohit
lieutenant-Rohit marked this pull request as draft July 26, 2026 01:51
@lieutenant-Rohit
lieutenant-Rohit marked this pull request as ready for review July 26, 2026 01:51

@alxkm alxkm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you for the contribution.

@alxkm
alxkm merged commit ef61ee8 into TheAlgorithms:master Jul 26, 2026
7 checks passed
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.

[BUG] SumOfSquares accepts negative input

3 participants