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.
Did you read the description?
going(8) -> 1.1466517857142857
which truncated gives1.146651
.but n is odd now. not even.
You say that the middle term is the one at the center, so m != n/2, m == (n+1)/2
But how to exchange the letters, and when do I should stop?
Obviously, if n is odd, the middle term is the one at the center.
EDIT:
n
means the length of string sequence(all strings formed by rearranging the letters in s, and ordering these strings in dictionary order), not the length of strings
.What means middle term? and if n is odd, how to proceed?
In "abcd", n = 4 => 4/2 = 2, there are 2 changes, but in "abcdx", n = 5 => 5/2 = 2.5, there are 3 changes. So how many changes should do if n is odd, or if n is par?
I think there is a mistake with the examples. going(8) => 1.146652, but in the example is 1.146651.
I use Ruby
Why are you asking this? There should be no tests with
index = 0
orqueue = []
.names = ["Sheldon", "Leonard", "Penny", "Rajesh", "Howard"]
Who is the first in the queue? => "Sheldon"?
Who is the next will drink the first cola? => "Sheldon"?
Who is the next will drink the 10-th cola? => "Penny"?
names = ["Penny", "Rajesh", "Rajesh", "Howard", "Howard", "Sheldon", "Sheldon", "Sheldon", "Sheldon", "Leonard", "Leonard", "Leonard", "Leonard", "Penny", "Penny"]
What happens if I pass an empty list of names?
What happens if I pass 0 as the umpteenth cola?
how does it work? Any documentation that support this assumtion... =)