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.
@hobovsky
to be completely frank, i see @akar-0's point as irrelevant to my suggestion.
plenty of katas specify a max value for an input. that is the suggestion i'm making - not to explain an implementation or arbitrary list of possible solutions. like you said, "stating limits of problems is always [a] good thing."
additionally, it's difficult to pin point advantages and disadvantages without knowing the constraints of a problem, regardless of skill level. i'd even make the argument that beginners especially are given constraints to guide them in the right direction, and that a beginner submitting a recursive solution would have trouble debugging their work given the current state of the kata.
@akar-0
what exactly is your point?
as i just stated, mainly for context at that, in my case, i had an issue with my original implementation when
n
>8059
. i'm aware a recursive approach is inefficient for some values ofn
.i was suggesting that the description be amended to hint that a recursive implementation will timeout because it is not clear how large
n
can be.for the js/ts version of this kata (and wherever else this may apply):
a note should be added to the description that the function is expected to handle large values of
n
. additionally, at least one test case should be added reflecting this caveat.i originally went for a recursive solution, and based on the test cases, i was surprised to find that my original implementation timed out (when
n
>8059
in my case).@Rlaur2 how so? it would be great if you could explain your thinking instead of providing a baseless response. furthermore, simply adding "challenge: complete this kata without converting
value
to a string" to the end of the description would do the trick. anybody who wants to can, and those who don't can just ignore it.i also took a peek at your solution and as i suspected, you solved this kata by converting
value
to a string. i originally completed this kata in typescript, but i completed it in javascript just to show you how it can be done. feel free to take a look if you aren't already familiar with the implementation.awesome kata!
in the spirit of diversifying solutions, a nice amendment to the description would be challenging folks to implement the function without converting
value
to a string 😁