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.
Study problems similar to this often simply return true/false. The Kata details don't really explain that the index of the found value should be returned.. not that it's hard to figure out, but for javascript (no explicit return types) it was a stumbling point for me to discover that the expanded test cases were looking for anything other than '1' to indicate success.
This comment is hidden because it contains spoiler information about the solution
I am not sure what I've done here with 'fork' I thought I was forking my solution, not the Kata..
I'm afraid it would be a bit too easy for cheaters, except with random tests...
Ooohhh.. it was showing me the diff between the answers. I've seen that before. OK.
Thank you!
I think I would have figured it out if the failure told me it was using 625 as an input.
The asserts could be written to include a message regarding the input:
int n = 625;
assertEquals("Unexpected result for input: " + n, "2 5 8 34 624", d.decompose(n));
Seems Codewars has problems!
For test3 the expected result is a STRING: "2 5 8 34 624" (same for the other tests) and I suppose you returned a string but your "4 12 33 624" is wrong becaause 33 is smaller than 34. Read again the description.
Java tests don't give the number to decompose but your reasoning with sqrt(1249) is false. Read again the description:-) The input is ALWAYS a positive integer. I must add that this kata is rather difficult, you must stick to it!
I am having trouble understanding some of the hidden tests after submitting my solution in Java.
The results don't make any sense to me.
For example:
The input is not stated, and confusion sets in when trying to understand the failure.
Doing the math:
Good, both are solutions for the same input.. It looks like the expected result is correct because it holds the
largest value.. but.. what's the input?
The details of the Kata explain that the input is a "positive integral number".. This is an invalid input for the
Kata, and more than that, I don't understand how a floating point number can be submitted as a long value in Java,
anyway.
So, I still don't know what was the input for this test failure, and I still haven't figured out the significance of
the 624 value in the output of the failed test.
The following tests present the same confusion:
Please help.. What am I missing? or are theses tests bogus?