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.
You are right! Thank you
This is the quick and dirty way.
I have no idea why this has so many "Best Practice" votes as this is a very very bad practice.
One way to measure how well algorythms handle large inputs is Big-O notation.
The Big-O notation of a given algorythm says how the size of the input relates to the duration of the execution.
This solution has O(n)=n -> the larger n is, the longer it takes.
The ideal solution to this Problem has O(n)=1
This means that it always takes the same amount of time, no matter how large the input is.
Yeah its few lines but is it readable?
I would never use inline if and for if it makes the code hard to read
Right now you are using logical OR to check if no requirement is violated
If you were to check if the requirements were met instead ( <= turns into >, >= turns into < etc)
and use logical AND to chain the checks, it would be a tiny bit more efficient.
If any of the requirements are not met, the rest of the expression does not need to be evaluated
as one false in a chain of ANDs will always equal false.
In this example the impact is negligeble but it is best practice to fail fast.
I have the exact same problem.
Is this happening because of strlen?