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.
@zLuki 2 substractions and 2 divisions? what if the sequence is consistent at the start but not in the middle? What if it the sequence breaks at the end of the sequence? They won't be a valid AP/GP anymore. Thus, you have to loop through the entire list to check. 2 check is not enough
LOL
Will do it.
sure
[0, 1, 0, 1, 0] --> 0 # none
Maybe -1?
Enforced 1 liner solutions will give this a 5, otherwise a 8 :)
Can you please make this a 6kyu one. Because I haven't seen any question as hard as this in 7kyu's.
I thought it was a 6kyu one. But the person approved it put it as 7kyu I guess. I cant do anything.
Too difficult to be a 7kyu.
No more issues, so we can approve?Looks good :)
Fixed
The tests are wrong again.
Are you just changing stuff at random hoping that this time it will be correct?
Done!!
No it is not. The Wikipedia article on arithmeric progressions doesn't list any limitations for
a_1
ord
, and googling for "arithmetic progression zero difference" gives results stating thata_1 = d = 0
is valid.Also, it is amusing to hear this from a person who expected a list of zeros to be classified as a geometric progression when, according to Wikipedia (at least), it isn't actually one.
I am no math guy and the only source I used is Wikipedia, but from what I;ve read there:
d
is not constrained in any way and can be 0.r
is defined to be different than 0.If these rules are correct, it would mean that:
[42, 0]
is a valid arithmetic progression with d=-42. It's not a valid geometric progression, becauser
would be 0[42, 0, 0]
is not a valid arithmetic progression, and it's not a valid geometric progression becauser
would be 0[0, 0, 0]
is a valid arithmetic progression with d=0. I am not sure if it's a valid geometric progression or not, becauser
can be anything, be it 0 or not. I think it's not a GP, I am not sure though.[42, 42, 42]
is a valid arithmetic progression with d=0. It's also a valid geometric progression with a ratio of 1[-42, 42, -42, 42]
would not be an arithmetic progression, but a valid geometric progression with r=-1So basically cases with
[x, 0, ...more zeros...]
are nasty edge cases, because:[0, 0]
,[0, 0, 0]
). It's also different than[x ,x, x]
because for x != 0 it's both AP and GP (example:[42, 42, 42]
)[42, 0]
)[42, 0, 0]
)Things depend on defintion, and maybe there are other definitions than ones I found on Wikipedia. But cases with trailing zeros are really tricky because answer depends on what's the first term, and what's the length of the progression.
Loading more items...