1]. DSA/3]. 450 DSA by ( Love Babbar Bhaiya )/Java/15]. Bit Manipulation/_04)_0_Total_SetBits_in_Range.java
import java.util.Arrays;

public class TotalSetBits1toN {
	
	static int[] setBitsinRange(int n) { 
		int ans[] = new int[n+1];
		for(int i=1 ; i<=n ; i++) {
			ans[i] = ans[i&(i-1)] + 1 ; 
		}
		return ans;
	}

	public static void main(String[] args) {
		int n = 5;
        System.out.println(setBitsinRange(n));
       
	}

}
