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 Count Total Set Bits from 1 to N (Bit Manipulation) #6997

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
Shewale41 wants to merge 7 commits into TheAlgorithms:master
base: master
Choose a base branch
Loading
from Shewale41:add-count-total-set-bits

Conversation

@Shewale41
Copy link
Contributor

@Shewale41 Shewale41 commented Oct 30, 2025

Description

This PR adds an implementation for counting the total number of set bits
from 1 to N using bit manipulation.

The algorithm efficiently counts bits using mathematical observation and avoids
iterating through all numbers, running in O(log N) time.

Type of change

  • New Algorithm/Data Structure

Checklist

  • Code follows TheAlgorithms/Java style and package structure
  • SpotBugs, Checkstyle, and CodeQL pass
  • Added Javadoc documentation
  • Added JUnit test cases
  • Verified correctness with multiple examples

Copy link
Contributor Author

Shewale41 commented Oct 30, 2025
edited
Loading

Hey @DenizAltunkapan @yanglbme @alxkm 👋 can you please review this PR , I have cleared all the checks can you merge my PR.
Thanks.

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.

1 participant

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