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.
That was fun. Thanks for your effort. But I bet you had more fun writing it.
And to the haters... you only dislike this kata because it is beyond your comprehension. Try a lower level kata.
@cforsyth68 I added
function
, thanks.I also used description you sent - thanks for that too.
the initial cod needs "function" in front of "findBall(scales) {"
otherwise, i think you got it. thx
nm
I feel it would be beneficial to add "function" in front of "findBall(scales) {", though, this is 5 kyu, :) people should know they have to add it.
@tiriana, consider using Preloaded section to define something but hide it from user. Maybe it can help designing example test cases (I'm not sure if it actually helps, I just wanted to highlight the possibility).
May I suggest something like this:
Your function - findBall will receive single argument - scales object. The scales object contains an internally stored array of 8 elements (indexes 0-7), each having the same value except one, which is greater. It also has a public method named getWeight(left, right) which takes two arrays of indexes and returns -1, 0, or 1 based on the accumulation of the values found at the indexes passed are heavier, equal, or lighter.
Your job is to write a method - findBall(scales) which will take the scales object and call its getWeight() method only twice to determine which index of the internal array has a greater weight.
@MMMAAANNN Great idea - thx for that, I will add it to description.
MMMAAANNN, that helps.
I simply want to know the method signature, including the expected result.
For example:
findBall(arrayOfBalls) {
// call scales.getWeight() only twice
return indexOfHeavyBall;
}
In addition, I think adding a couple example unit tests would help the most. At least then we know what the method accepts as parameters and what to expect as output.
tiriana, your spelling errors should also be corrected.
"Your function - findBall will receive single argument - scales object. ----> I has only one method <----"
You sound like you're speaking Engrish. I suggest finding someone who speaks English to proofread for you.
You should also define what a "single argument" is exactly. Is it an array of integer values representing ball weights? If so, say that! Please avoid ambiguity. This isn't an in-person interview where we are able to ask you clarifying questions, so you need to be clear from the start.
You should probably add an example of how .getWeight() method is used. Like this:
Hello :)
I must say that 'This is the worst Kata I've seen' made my day :) I admit - the instructions could have been more clear, but to call it 'the worst'? :) I LOLed hard, thanks for that.
I changed the description - please let me know if it's better now.
How did this get thru beta? This is the worst Kata I've seen. Clear up the instructions! I solved this but there's no clear instructions for how the solution should be implemented. Where does the 8 element array of numbers come from? What should the method return?
I wish there was a way to down vote.
You should add these test cases, where first is not capitalized, or call it Pascal case instead...
Test.assertEquals(toCamelCase("_the-stealth-warrior"), "theStealthWarrior");
Test.assertEquals(toCamelCase("-the-stealth-warrior"), "theStealthWarrior");