Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Whats the runtime?
Is learning how to write a slow, inefficient code in your favorite language a good lesson? According to some, yes.
Is learning that a good solution to a problem is often generic, and can be achieved in any language, a valuable lesson? According to some, no.
Is it true that the most valuable skill in programming is writing fors, ifs, loops, and functions? According to many, yes.
Is it true that finding a way to solve a problem with a computer in a way which is quick and cheap is an important aspect of programming? Apparently, not.
You are saying you are here to learn Rust. Are you here to learn how to write good solutions to problems with Rust, or are you here to learn how to write poor solutions to problems with Rust? Ability to write ifs in loops in ifs in loops and make your computer choke on a simplest problem is not a really valuable skill, is it. Ability to find good solutions to domain problems, on the other hand, is something what marks a skilled programmer.
Please use spoiler flag next time.
This comment is hidden because it contains spoiler information about the solution
Beautiful solution.
This here is the secret, granted you can understand what is written here.
This comment is hidden because it contains spoiler information about the solution
After doing this with 28 lines of code, this solution has blown me away. I never was much good at maths though.
love it
Just a note: in real code, it is important to mark this kind of alias with
const
, otherwise callingcountbits
will result in dynamic dispatch each time (which incurs a severe performance penalty).Elegant, clever, performant. That's the best solution for this problem.
can someone explain this?
Inclusion–exclusion principle
Probably because it shows understanding of Java syntax.
Also, what is your solution? Do you know a faster way to perform it?
use spoiler tag next time :)
Loading more items...