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.
I know it's a two year old question, but I'll bite, as I wrote a very similar solution (technically, it's two lines, not one).
In this case, it was a pretty simple problem and the code was initially written on one line. It would have taken more time and effort to deconstruct it into multiple lines. Arguably, if you spread it over as many lines as possible, it would have been harder to read, so you have to decide what stays together on one line and what splits up. That all takes time and mental effort - and it's just another 6kyu kata that I just want to tick off.
Other times, I take an initial long, rambling, solution and cram it onto one line, often simplifying it in the process. In those cases, I am just having fun - trying to make it concise and elegant. If it was production code that another programmer would have to work with in the future, I might still do this - in order to see what can be simplified - but then I would rewrite it in a clear, unambiguous and self-documenting manner (which would usually necessitate it being multiple lines).
very nice solution
#11b33/3q9:0z:vV
i can see the appeal of writing code like neutron star material
your code is very concise and elegannt
What's the appeal with cramming all of this on one line? You have the exact same solution as pretty much everybody that answered this question, except yours is a nightmare to read. Look at my solution. It does all of the exact same stuff as yours, but it would only take someone about 8 seconds to read and understand mine. Cramming everything on one line does not make it clever.
Thanks for wise advice
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Thank you for the advice :)
don't use
is not
for integers, use!=
; it so happens that smallint
s are cached but don't rely on this!The only solution that doesn't involve comparing to char '7' and actually uses math to solve the problem. Chapeau!!
@
da_big_fella
: If you're autodidact, CW will learn you that. ;) If you had programation courses other than simple introduction courses, your teachers should have... :/I don't think you understand how arrays and objects work in most languages.
Just wait until you write all kinds of functions with side effects in production code, and see everyone want to beat you to hell for all the bugs you're causing :P
Well, my mother never taught not to. How should I know it's standard practice? If you don't want your arrays mutated, don't pass them by reference into my functions.
The solution shall assert if the input is a string or not
Random test cases added.
Loading more items...