Ad
  • Custom User Avatar

    A clarification would still be appreciated. For example, in test case find_all(35, 6), 107999 would be valid even though there is a zero after the one. Zeros that are not the first digit do count in the value of the number.

  • Custom User Avatar

    Thats redundant since 0 would never be greater than it's predecessor digit. And since 0 can not be the first digit, as 0's in front don't modify the actual value of a number, any 0 to the right would never satisfy the incrementing condition.

  • Custom User Avatar

    thank you for the translation i have approved it. I only have experience in JavaScript so this is a big help. Thx

  • Custom User Avatar
  • Custom User Avatar

    yeah will

  • Custom User Avatar

    In the example section in the description:

    prizeCounter(['R', 'R', 'R', 'R'])
    // output will be 800 because you get 100 from each of the first 3 R then you get the bonus of 100 and it deactivates meaning that the
    // fourth R doesn't give any points so 100 + 100 + 100 + 500 = 800

    I think the second "100" is meant to be "500". It's a small typo, I know, but nonetheless it should be update :).

  • Custom User Avatar
  • Custom User Avatar

    The description does not clearly say that 0 is not a valid number to use. As long as you put it in the description it will be fine. Thx!

  • Custom User Avatar

    all fixed

  • Custom User Avatar

    Small description typo: thew -> the

  • Custom User Avatar

    nitpicking on every single implementation? sure! x)

  • Custom User Avatar

    this is a good solution and i will look into it but i am going to be taking a break for a few hours to go and do something

    is this what most higher level kyu's do?

  • Custom User Avatar

    Instead of having these huge arrays (1000 is still unweildy to debug) you could

    a) chop them up into smaller segments
    or
    b) shrink them after having found one that doesn't pass. "shrink" here meaning trying smaller but similar arrays while they still produce wrong answer. for example, removing the first or last 25% of the array repeatedly:

    const findSmallerCounterEx = s => {
      const candidates = shrink(s)
      // test all the smaller candidates
      for (const candidate of candidates) {
        const expected = test(candidate)
        const actual = prizeCounter([...candidate])
        // this one still fails, keep shrinking that one
        if (!_.isEqual(expected, actual)) {
          return findSmallerCounterEx(candidate)
        }
      }
      // nothing smaller found
      return s
    }
    
    const shrink = s => {
      // no smaller suggestions possible
      if (s.length < 1) return []
      // two suggestions: take off 25% at the front, 25% at the back.
      // should probably check my math here so that it's guaranteed to be smaller than s
      // if it's the same size it'll loop infinitely
      return [s.slice(0, Math.floor(s.length * 3/4)), s.slice(Math.ceil(s.length / 4))]
    }
    
  • Custom User Avatar

    ok thankyou for the math behind it. I never actually calculated it and just assumed that 10000 was a solid number because actual data is much larger. I have changed the values and now the smaller tests can have anywhere from 0 - 30 characters and the larger one will have anywhere from 0 - 1000 characters. Thank you for helping

  • Custom User Avatar

    I will try to look into making it have rules but i am not high honor or kyu so i dotn think i can look at the rules and test of the kata you have mentioned

  • Loading more items...