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.
JS version update
Returning inconsistent datatypes is not a best practice. How about
["",-1]
if there are no interesting substrings?Also, use valid input and appropriate datatypes. Why give us a space-separated string when you can give us an array of strings? Every solution starts by splitting on whitespace and lowercasing everything ( not necessarily in that order ), but neither of these is the essence of the task.
Gorgeous
As mentioned below, needs random tests.
I must have been blind.
It's stated in the description to return
undefined
when the array has less than 3 elements.Yes.
Try to find in the description when to return
undefined
.can you be more specific?
Description does not specify all possible return values.
Thanks for your answer... Now you can see two solutions - the older one is wrong for some special cases, i corrected it because of your explanation;-)!
hi. I gave a standard mathematical definition of an arithmetic progression and was referring to the mathemtical difference by a constant quantity (in this case you're right, the quantity is 0). I see how the word 'differs' can be misleading, so I changed the kata description(just the defintiion of the arithm seq bit) to make it more clear.
thanks for pointing that out!
Hi, can you please explain testcase "Test.assertEquals(hasArithmProg([2,2,2,2]), true)". It doesn't differ, so it should be false. But if difference 0 is ok, it should be 0 (instead of true), because minimal 3 numbers and here are 4, so index is 0 and/or 1 (two included), so result=0 and not true??? Read and did it quickly, so maybe i haven't seen something;-)...?
Random tests needed.
The thought of this solution is simple.
Hope it clarified. :)
Hi, can you give further explanations on your solution?
Loading more items...