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

Added HappyNumber algorithm in maths section #6571

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
ruturajjadhav07 wants to merge 5 commits into TheAlgorithms:master
base: master
Choose a base branch
Loading
from ruturajjadhav07:add-happy-number

Conversation

Copy link

@ruturajjadhav07 ruturajjadhav07 commented Oct 1, 2025
edited
Loading

Description

This PR adds an implementation of the Happy Number algorithm in HappyNumber.java along with corresponding unit tests in HappyNumberTest.java.

  • Implements cycle detection (Floyd’s Tortoise & Hare method) for efficiency.
  • Includes detailed Javadoc and examples.
  • Unit tests cover known happy numbers, unhappy numbers, and large input cases.
  • 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: Happy Number
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

Notes

  • Added both the algorithm and its unit tests.
  • Used Wikipedia reference for algorithm definition.

Copy link

codecov-commenter commented Oct 1, 2025
edited
Loading

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.51%. Comparing base (d8ddb07) to head (59b233f).

Additional details and impacted files
@@ Coverage Diff @@
## master #6571 +/- ##
============================================
+ Coverage 75.50% 75.51% +0.01% 
- Complexity 5688 5693 +5 
============================================
 Files 694 695 +1 
 Lines 19570 19583 +13 
 Branches 3791 3794 +3 
============================================
+ Hits 14776 14789 +13 
 Misses 4217 4217 
 Partials 577 577 

☔ 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
I hope you're doing well! I wanted to follow up on my pull request where I added the HappyNumber algorithm to the maths section of the project. I noticed there hasn’t been any feedback yet, and I just wanted to check if there are any questions or if something is unclear about the changes I made.

Please let me know if you need any further details or adjustments. I’d appreciate any feedback when you get the chance.

Thanks in advance for your time!

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 によって変換されたページ (->オリジナル) /