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.
Somnetime you have write a program that pukes out data, see if you can see a pattern. So you can write a shorter program.
I like these is...Valid variables so much. But also, I think the early return of -1 and getting rid of 'else' would enhance the readability of this code.
Perfectly explained for everyone!
This comment is hidden because it contains spoiler information about the solution
don't waste your time..
I really don't want to be harsh but it may not be clear to those not in the know that this is a really really horrible solution.
while(data.length > 0)
. I'm going to assume that he just gave 25 so that his loop would iterate answers up to 25 bytes long.. his solution will always iterate at least 25 times, and for data with more than 25 bytes, his solution is not guaranteed to work.Very clever.. don't do this at home.
Requirements specified input is guaranteed to always have 8 bits per byte. No need for data.length check.
I don't think "Clever" and "Best Practice" really express what something like displaying a performance rating would. If producing a performance metric is truly impossible (please hire more help??) then at least provide another upvote mechanism such as "Bad Practice".
There isn't currently a way to convey quickly and clearly that a particular solution is bad practice. I understand the text of "They usually are not code that you would to put into production" but I would advise changing the wording to "Do not use this code in production" if you're not going to provide a better way for those learning to distinguish what should and should not be used.
This comment is hidden because it contains spoiler information about the solution
Am I the only one thrown off by the use of parenthesis for the return?
It's valid.. but weird and honestly the first time I've seen it in a very long time.
Why not?
Excactly. This comment should be permanently added into this solution.
This is much better than the top one.
This comment is hidden because it contains spoiler information about the solution