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.
This comment is hidden because it contains spoiler information about the solution
You're returning a string instead of a float.
Well, my thought was to first coerce it to a boolean (!!) and then negate it. Something like this might make it more obvious:
!(1.to_bool)
Anyway, I think you're right that it's not necessary. I just sort of assumed there might be some edge case where a single negation would result in a non boolean value but I don't think that would ever happen.
This solution doesn't account for the ordering of people.
If you had 100,25,25,25 this would pass but it should fail.
How is it a NO?
First four people need no change, so we have
$25 x 4
Next person pays $50, we give them $25 change so now we have
$25 x 3, $50 x 1
Next person pays $100, so we give them $50 + $25, left with
$25 x 2, $100 x 1
Last person pays $50, so we give them $25. End with
$25 x 1, $50 x 1, $100 x 1
Cool kata. Thoughts on my solution?
http://www.codewars.com/kata/reviews/5309441451e700dea00000fb/groups/556f7b03f5470dca2a0000b7
This comment is hidden because it contains spoiler information about the solution
I'm curious as to why this is 3 kyu, it seems a lot easier than that.
You are correct that you need at least two data structures, but which ones to use are part of the challenge!
Interesting solution, but not quite what I was looking for. I'm surprised this passed the large input test!
You can solve this without iterating through any of the values.
This comment is hidden because it contains spoiler information about the solution
Nice, but you need to disable things that can evaluate expressions like eval,
instance_eval, and probably some others I can't think of right now.
Depending on how challenging you want this to be, perhaps disabling the built in random methods might be a good idea.
Is the Ruby translation provided correct?
Getting nil for the test case:
["Jun Hono", "Jun Hono", "Koji Kabuto", "Maria Fleed", "Jun Hono", "Maria Fleed", "Koji Kabuto", "Koji Kabuto", "Jun Hono", "Jun Hono", "Jun Hono", "Jun Hono", "Jun Hono", "Jun Hono", "Jun Hono", "Jun Hono", "Maria Fleed", "Jun Hono", "Maria Fleed", "Koji Kabuto"]
There are 12 instances of "Jun Hono", and the list length is only 20.
For 0, the correct form should be "0th", not just "0".
See: http://en.wikipedia.org/wiki/English_numerals#Ordinal_numbers