Ad
  • Custom User Avatar

    Good question. I'll look into it.

  • Custom User Avatar

    updated as above.

  • Custom User Avatar

    I went with your original premise and updated the description with a hint: somestring.count('')

    So in the test cases, there is now:

    test.assert_equals(rolling_sum([1,2,3],0),4)
    
  • Custom User Avatar

    I think I see what you are saying. If we say that sub-arrays must have length > 0 then

    rs([],0)
    

    would be 0 instead of 1, which is mathematically incorrect

    I don't like the idea of removing s = 0, though - that seems even more "special", requiring a special line of code (in solutions and tests) rather than a change in algorithm. I might have to agree with your original assessment to use the empty sets like the builtin does.

  • Custom User Avatar

    I would argue that logically, we should count at most one way to make an empty set.

    For example, sum(xs[3:3]) doens't make sense for an array of length 3. By this logic, all of these return 0:

    sum(xs[4:4])
    sum(xs[4:9999999])
    sum(xs[-1:-1])
    

    so there would be an infinite number of ways to sum to 0.

    Would you consider this issue better resolved by stating in the problem that the length of the sub-array must be > 0 or by specifying that using an empty set counts as only 1 solution, even if it can be derived multiple ways?

    I think it should be the latter because it makes sense that

    rolling_sum([],0)
    

    should equal 1, not 0.

  • Custom User Avatar

    Added 10 smaller random tests

  • Custom User Avatar

    It seems like rolling_sum([1,2,3],0) should return 0 since there are no ways to make a sum of 0 with the integers given. You feel like that is not the proper solution?

  • Custom User Avatar

    All tests moved to new framework.

  • Custom User Avatar

    Removed all code in preload and moved it to new test framework

  • Custom User Avatar

    Awesome, thanks. I will check it out and update it.

  • Custom User Avatar

    Where can I find documentation on that?

  • Custom User Avatar

    Thanks. Issues fixed.

  • Custom User Avatar

    Isn't the whole point of writing an 8kyu problem that it is for noobs?

    I don't really understand the point of your second comment. I'm sorry you think that teaching kids only produces garbage.

  • Custom User Avatar

    Well, I teach kids who are new to programming so they would solve it with for loops and (honestly) probably 62 'if' statements. That's fine for the first time, but I love the Katas that have several levels, so you are forced to think about how to make your program better. Just looking at the top solution doesn't really teach them how to come up with it on their own. So I was thinking of making a sequence of 2 or 3 problems where they have to improve their solution each time.

  • Custom User Avatar

    @Blind4Basics - the reason for part 1 is to give an easy introdution. I was going to add a part 2 with a maximum solution length of about 70 characters so that the user has to use a single join/filter/lamnda statement. Would that also be too boring/common?

  • Loading more items...