• Custom User Avatar

    🦊

  • Custom User Avatar

    I'm not enough of an expert to answer your question, but would like to mention that it is possible (though not necessarily better) to solve this without using switch or if statements.

  • Custom User Avatar

    I think I corrected this now. But some solutions still show up as invalid, even though I tried to copy-paste them and they actually work fine with new test cases. Could be some CW glitch.

    EDIT: All good by now, all valid solutions with old names are valid again.

  • Custom User Avatar

    Ok

  • Custom User Avatar

    If you are ok with it, I'll do the work that MMMAAANNN suggests :)

  • Custom User Avatar

    can you gimme the whole test case :)

  • Custom User Avatar

    You changed it to a wrong name. should be 'nameShuffle' or 'nameShuffler'. As far as I know, there is no word 'suffle' or 'suffler' in English.

    Also, when you change the main function name, consider adding support for the old name as well, because otherwise all old solutions become invalid. To do provide back-compatibility, just add a line like this to the test cases:

    nameShuffle = nameSuffle = nameSuffler;
    
  • Custom User Avatar

    yeah i'll change tq:)

  • Custom User Avatar

    Hello.

    Balls are random and hiden in scales object. You will receive scales during test cases. You can only use scales.getWeight(leftPan, rightPan).

    Let's say that randomly generated balls are [1,1,1,1,1,1,1,2] - last ball is heavier. In such case findBall should return 7 - index of heavier ball.

    I've just added some example scales you can use for testing: exampleScales_firstBallHeavier, exampleScales_secondBallHeavier, exampleScales_lastBallHeavier. They are global so please try to play with them.

    If you have any more doubts - please ask ahead.