Ad
  • Custom User Avatar

    I may have not completely understood the instructions, but why would solve("czaccb") give "czab" instead of "zacb"?
    I naively thought that you should use a rolling algorithm to remove each duplicate beginning on the left side :

    czaccb -> _za_cb -> zacb
    

    edit : this algorithm works with the second example

    geeegfffgdadd -> _eee_fffgdadd -> eeefffgdadd -> __efffgdadd -> efffgdadd -> e__fgdadd -> efgdadd -> efg_a_d -> efgad
    

    What am I getting wrong?

  • Custom User Avatar

    should include some examples where equation starts with a negative number. e.g. -2*3 etc.

  • Custom User Avatar

    Note: since n can be a very large number, it will be represented as a binary string.

    Use appropriate datatypes. Python has arbitrary precision ints, so this non-standard encoding is unnecessary.

  • Custom User Avatar
    • Description should be language-agnostic.

    • The note part can be simplified to the 2nd argument will always be greater than or equal to the 1st one.

  • Custom User Avatar
  • Custom User Avatar

    Missing solution and framework import in Python's tests and sample tests

  • Custom User Avatar

    Python random testing allows for an insufficient solution to intermittantly pass. High enough values, such as n = 525194 should be guaranteed to be passed to the user.

  • Custom User Avatar

    350417903 866449540
    [11, 27601766442010420] should equal None

    I have received that in the test attempts, with several different cases. I believe that in those cases the"None" is wrong

  • Custom User Avatar

    Hi,

    Good one, but hard (like most of the time with you). I've got the longest solution so far, but the fastest as well, so... at least I didn't lose my time.

    • There is... this in the sample tests: print(disputes([['#']])), which is useless and invalid (and makes solutions fail)

    • Missing sample and fixed tests:

    [('''\
    ##.....#
    #.....##
    ..###.##
    .####...
    ##..####
    #.#.##.#
    #.#.####
    ...##...
    ....####
    #...##.#'''.split('\n'), (33,1)),
    
    ('''\
    ##.#.##.#.#
    ........#..
    #...###.###
    .#..#.#..##'''.split('\n'), (28,8)),
    ]
    
    • More sample tests could be a good idea as well, but I think with the 2 above that could be enough. Note that you could increase easily the number of sample tests by rotating the grids (actually useful for my approach only, but...)

    • The stress tests have to be put after the batch of small random tests (at least) => the test suite could be split differently so that the perf checks are all done last. Something like:

      • describe: warm up
        • it: fixed tests
        • it: small random tests
        • it: medium random tests
      • describe: performance tests
        • it: stress tests
        • it: random tests
    • The batch of small random tests has to be extnded to at least 50 tests. It costs no time at all, and allow to properly debug the solution (I actually discovered the edge cases above by chance, running a fork. My code was passing all other tests otherwise)

    • The specs of each batch have to be at least hinted in the description:

      • typical number of tests
      • typical grid dimensions
      • typical number of countries (possibly)
      • typical amount of unclaimed territory (possibly)

    Cheers!


    Edit: oh, and this fixed test must be added as well. Very important...

    #...#..##.#...
    .###.#.#.###.#
    ..#.#........#
    #.#....#......
    .###......#.##
    .###...##.##.#
    ######.#####.#
    ..#.##.#####..
    .###..######..
    #.#.##########
    .###..######..
    ..#.##.#####..
    exp = (62, 23)
    
  • Custom User Avatar
    • not enough small random tests (but WHY 3 only!???):

      Fixed Tests
      Example Test Cases
      (2 of 2 Assertions)
      
      Stress Test Cases
      (2 of 2 Assertions)
      Completed in 1805.90ms
      
      Random Tests
      
      Small Random Test Cases
      (3 of 3 Assertions)
      
      Medium Random Test Cases
      (396, 82) should equal (391, 89)
      (125, 56) should equal (125, 59)
      (237, 61) should equal (233, 68)
      (174, 35) should equal (173, 36)
      
    • the acutal profile of the random tests aren't given (how many tests of this or that kind / typical sizes, but typical number of groups as well)

    • the stress test should be described as well

  • Custom User Avatar

    Missing an edge case where every land is unclaimed (the map is full of #). The expected result should clearly be (0, 0), but all existing solutions (except mine) fail at this case.

    (This is not ruled out by the description, and logically has no reasons to be excluded. Some lands could just be that pure ;-))

  • Custom User Avatar

    Perhaps include a larger non-symmetrical sample test?

  • Custom User Avatar

    Why 1-based indices in Python?

  • Custom User Avatar

    The input range is missing. How big can max_x, max_y and num_reflections be? How big is the coordinates of point, and can they be 0 or negative?

  • Custom User Avatar

    Hey!! I'm a bit overwhelmed by this interesting Kata. I have come up with a solution but it is some seconds slower than expected. Any help for someone like me with no idea of algorithms??

    Thanksss!!

  • Loading more items...