Creative writer who became a robotic developer. Co-founder and Head of Product https://roshub.io
You can create a type definition file that extends the NodeJS namespace to enable…
I was first amazed by the sieve 6 years ago. And now to reinspect it again, still impressed by such a basic algorithm.
This algorithm was made to count prime. In a way, it is quite similar to dynamic programming, minus the sub-problem.
For those who read codes, go here.
Count the number of 1 in a binary.
Take a look at 10110101, how do we count the amount of 1?
The naive solution is to loop through the number and check if the bit is 1, then ++count.