Ad
  • Default User Avatar

    @squishy oranges, what do you mean do the summation directly? A double for loop doesnt work for me either. I've tried condensing one of them using sum() and the for loop as a one liner but it still times out.

  • Default User Avatar

    I'm having trouble with this one. I'm just using the standard dot product algorithm and I always exceed the time limit. When I use recursion, I exceed the max recursion rate and I can't import sys to increase it. I don't understand how to make this faster.

  • Default User Avatar

    The recently included test case that verifies food is only consumed once is causing a contradiction with other test cases.

    Some tests assume food remains in the field after being eaten so this Kata is no longer solvable.

    Example:

    moves = '7 D 7 R 3 U 1 L 7 U 6 L 1 U 5 L 6 D 3 L 8 U 6 L 2 U 3 R 1 D 5 R 5 D 4 R 4 U 7 R 2 D 4 R 7 U 8 R 4 D'

         field = ['ooo-$----$-$--$----$-',
                  '--$-------$-$$------$',
                  '$----$$-$--$-$-$--$--',
                  '$---$--$-----$-------',
                  '-$$$---$----$$$--$---',
                  '$--$$---$----$$-$-$--',
                  '-$--$$$--$$--$-$-----',
                  '$---$------$---------',
                  '-----$-------$-$$--$$',
                  '-$$-$---$-$-$$$--$-$-',
                  '-$$----$-$$----$-$$-$',
                  '$--$-$---$-$-----$-$$',
                  '-$$$---$-----$$$----$']
    

    The test says ((0, 4), 33) should equal ((6, 10), 21) but this could only be true if the snake ate the same food twice and was long enough to collide with itself.

    I've found a few other scenarios like this.

  • Default User Avatar