Java icon indicating copy to clipboard operation
Java copied to clipboard

Added Count Total Set Bits from 1 to N (Bit Manipulation)

Open Shewale41 opened this issue 1 month ago • 1 comments

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

  • [x] New Algorithm/Data Structure

Checklist

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

Shewale41 avatar Oct 30 '25 15:10 Shewale41

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

Shewale41 avatar Oct 30 '25 15:10 Shewale41