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.
That's the thing, they aren't. It's a culture thing :D
People just upvote one-liners as best practice for the sole purpose that it compacts more code into a smaller space and is thus seen as minimalist or cool.
Of course, sometimes (such as for list comprehensions or for cases where it's easier to use a built-in function) one-liners are actually best practice, but half the time, it's more likely to be someone using some esoteric, relatively niche and/or inefficient code in a one-liner.
But it's been 11 months so you probably know by now.
one liners can be clever, but not best practice most of the time (I agree with you)
For anyone reading this now, its generally better to use fstrings
Was not aware that you didn't need case keywords and could just use lamda expressions in a switch. Huh, cool.
Huh, nice. First C# problem that I matched with the top solution. Was pretty weird coming from python and C and having to learn all of the built in methods again.
Here I thought I was being clever... and completely overlooked the simpler solution.
This comment is hidden because it contains spoiler information about the solution
I fully agree with you. It should not be. This is not so clear especially for the beginners like me.
I feel, uh... really dumb for forgetting lambda functions exist and packed everything into a tuple instead... whoops.
Why is char *alternateCase (char *string) repeated here twice?
For some reason, reading this made me realize hajime! means begin!
For those that are interested in a possible O(n) solution, what I did is a pretty rough example. Not the prettiest or optimal but should be time efficient.
Ahh, that makes sense! Completely misread this, thanks for clarifying!
This is not what that means. The description means that when you are given an input like
(3, 2)
, then your result would be6x^1
. Now in real life, an exponent of^1
can simply be ignored, and we would just write6x
, however the kata specifically says not to truncate this (because it is an 8kyu kata), so the correct result is just6x^1
.In the original code challenge for "Take the Derivative", it states: "^1" should not be truncated when exponent = 2.
This version aligns the tests to take into account situations where exponent = 2.
Loading more items...