Ad
  • Custom User Avatar

    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.

  • Custom User Avatar

    the initial cod needs "function" in front of "findBall(scales) {"

    otherwise, i think you got it. thx

  • Custom User Avatar
  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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");