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.
tried without any predefined looping functions
Be aware that the stack space here can become huge for bigints. It's a better practice to use tail recursion for constant stack space.
Please mark your post as having spoiler content next time,
Read the description again:
This comment is hidden because it contains spoiler information about the solution
There can be valid reasons to mutate inputs ( eg. performance. did you ever stop and wonder why eg. default JS sorting behaviour is modification in place? ). So if a kata specifically specifies ( and tests! ) this behaviour, you can have your doubts, but it makes a valid kata.
I fully agree side-effect-free programming has its advantages ( as well as its disadvantages, but you're not even mentioning those ). But single-mindedly forbidding valid language features in kata, or even kata about valid language features, is just closed-minded. Everything's a trade-off, including side-effect-free programming.
Updated JS version for this issue ( both, actually ).
Related, but not exactly the same thing: should probably give a useful failure message when solver returns a new value instead of mutating the input.
This is a
7kyu
kata; solvers may actually not know the difference.Try reading up on "side effect".
It might be a good idea to research how arguments are passed by reference in python. I'd suggest googling for it.
The solution here is simple, but these test cases test the side effects of this function and not an actual return value, how you'd expect in a proper test scenario.
I'm not sure how to manipulate the global values from the test case in python.
Thanks for the clarification. They are very useful and broaden my knowledge on this subject.
This comment is hidden because it contains spoiler information about the solution
Imagine someone is having two last names like it's normal in hispanic cultures. The code only works within the limitations of the exercise requirements.
Loading more items...