hmmm.... think of this... no of 1s in bin no of size 1 is 1 2 is 2 pow 1 + no of 1s in size 1 3 is 2 pow 2 + 2 * no of 1s in size 2 4 is 2 pow 3 + 2 * no of 1s in size of 3
think in this lines... On Jun 21, 2013 8:33 AM, "shubham saini" <[email protected]> wrote: > How to count no of set bits for all numbers from 1 to n for a given n... > > i knew brute force any better solution ?? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
