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.
(Ruby) When the weights are the same ie: "30KG", "30000G", "30KG" only the order that starts with KG is accepted: "30KG", "30KG", "30000G".
Also "90000G", "90KG" is not acceptable, but "90KG", "90000G" is.
This comment is hidden because it contains spoiler information about the solution
Ruby: on the test's if I had raise "Error" if (wrong type,etc)...then the tests would fail.
But if I put return "Error" if (wrong type,etc) they passed. The opposite is true for final submission.
I hit submit a few more times and it worked. Whatever.
I'd have this kata solved in ruby except out of the hundreds of scores one improvement is -57.49999999999999. 13 nines rounds to -57. If my value had 14 nines then it would round to -58, which is the answer for the test case.
I was not able to pass final submission. All of my test cases work in IRB. I have more than a few katas in my unfinished pile that work in IRB & I think should work. Let me know if you get it to work.
Has anyone solved this in Ruby? I keep coming back to this one and cannot get a solution that does not time out.
ah, subtract in kind to only leave positive values.
how can [1,0] and [0,1] yield the same answer? (1)?
(Ruby) cannot pass the invalid string input tests (only for submit, test button works). If I return 'error' or false, I still get: "The function somehow worked with wrong input"
"6F43E8"
"Error"
The function somehow worked with wrong input
"1234 "
"Error"
The function somehow worked with wrong input
""
"Error"
The function somehow worked with wrong input
Not sure why this is failing (ruby). On the second to last test, the expected result for (:player2=>[[5, 5]]) isn't even on the input array to the function.
Creature battles
[[1, 1]]
[[1, 1]]
Test Passed: Value == {:player1=>[], :player2=>[]}
[[2, 2]]
[[1, 1]]
Test Passed: Value == {:player1=>[[2, 2]], :player2=>[]}
[[1, 1]]
[[2, 2]]
Test Passed: Value == {:player1=>[], :player2=>[[2, 2]]}
[[1, 1], [2, 1], [2, 2], [5, 5]]
[[1, 2], [1, 2], [3, 3]]
Test Passed: Value == {:player1=>[[5, 5]], :player2=>[[1, 2], [3, 3]]}
[[1, 2], [1, 2], [3, 3]]
[[1, 1], [2, 1], [2, 2]]
Expected: {:player1=>[[1, 2], [3, 3]], :player2=>[[5, 5]]}, instead got: {:player1=>[[1, 2], [3, 3]], :player2=>[]}
[]
[[1, 1], [2, 3], [10, 10]]
Test Passed: Value == {:player1=>[], :player2=>[[1, 1], [2, 3], [10, 10]]}
This comment is hidden because it contains spoiler information about the solution
I can't figure out the prbblem here (ruby). On final submit i get the error message: (page_index returned incorrect value when provided a item_index argument that was out of range)
Even though all of my tests pass?!
Test.assert_not_equals(helper.page_index('f'), 3)
Test.assert_equals(helper.page_index('f'), 1)
Test.assert_equals(helper.page_index('a'), 0)
Test.assert_equals(helper.page_index(-12), -1)
Test.assert_equals(helper.page_index('bollocks'), -1)
Test.assert_equals(helper.page_index(nil), -1)
Test.assert_equals(helper.page_index(false), -1)
Ah, thanks. Despite trying a few different approaches I can't get the final calculation done in under 6 seconds. Some of the requirements of these problems are very opaque.
My (Ruby) solution passes all test on this website & my own, yet get error message:
each': failed to allocate memory (NoMemoryError) from
to_a' fromsolution' from
block in'
from
wrap_error' from
it'from
it' from
'
Ugh. Infuriating.
Loading more items...