Skip to content

Conversation

@Shewale41
Copy link

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

@Shewale41
Copy link
Author

Shewale41 commented Oct 30, 2025

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant