Yes. Exceptions shouldn't be used for flow control. In a real setting, you'd probably parse it as a long (and possibly catch that exception) then check the size for the actual type.
That being said, it is really easy to see what is happening, which is good.
I would, no offense. The description of the problem leaves much to be desired anyways. What's next should we call the fibonacci series as "a collection of numbers where a number is the sum of the previous two" so that its harder for people to research if they don't know about its existence. I can hardly understand how the function should be written without looking at the tests and rereading the description 3 times. There are ways to write a description which makes things interesting without holding the person's hand.
Edit: To clarify I really don't mind googling as much as some here in the comments, that's how I have learned anything especially regarding programming or pen testing, but give better hints. Otherwise it was quite a fun kata.
I wouldn't call myself lazy. I purposefully left out the formula for someone to figure that out themselves... The problem came in when a moderator down-rated it to 8 kyu without changing anything in the description.
It was a fun kata, but the author should indicate that you need to analyze not just the code but also the text of the Sample Tests. Considering this is an 8 kyu kata, it's important
Very elegant solution )))
It's just a nasty kata that needs a really good description )))
Yes. Exceptions shouldn't be used for flow control. In a real setting, you'd probably parse it as a long (and possibly catch that exception) then check the size for the actual type.
That being said, it is really easy to see what is happening, which is good.
And it looks pretty. :-)
Wouldn't the code be slower because of the try-catch check?
Тоже ни разу не слышал про такое. Но задачу решил)))
I would, no offense. The description of the problem leaves much to be desired anyways. What's next should we call the fibonacci series as "a collection of numbers where a number is the sum of the previous two" so that its harder for people to research if they don't know about its existence. I can hardly understand how the function should be written without looking at the tests and rereading the description 3 times. There are ways to write a description which makes things interesting without holding the person's hand.
Edit: To clarify I really don't mind googling as much as some here in the comments, that's how I have learned anything especially regarding programming or pen testing, but give better hints. Otherwise it was quite a fun kata.
Examples describe better than words before them.
I wouldn't call myself lazy. I purposefully left out the formula for someone to figure that out themselves... The problem came in when a moderator down-rated it to 8 kyu without changing anything in the description.
Bad description
This comment has been deleted.
"The sorting should NOT be case sensitive" - but it is.
This is not an 8 kyu kata and description is not good.
When people say that you don't need math for programming, and then you try to solve this kata )))
This kata's discription is a good example of how to easily turn simple things into difficult ones )))
This comment is hidden because it contains spoiler information about the solution
It was a fun kata, but the author should indicate that you need to analyze not just the code but also the text of the Sample Tests. Considering this is an 8 kyu kata, it's important
Loading more items...