Ad
  • Custom User Avatar

    Pretty challenging and funny evilized version of the series, I like it.

  • Custom User Avatar

    This is really quite novel. Nice!

  • Custom User Avatar

    It's not dissimilar to a 'for' loop with a list. Think of it as 'for [any item] in [what I'm telling you to look at]'.

    In this case we're telling the program to look at a string, so the 'any item' is just 'any/each individual letter'. 'C' is simply a placeholder for that.

    I appreciate this is checks watch 11 months late, but I hope it helps if you ever return here!

  • Custom User Avatar

    If you just return True when there are 20 things marked as 1, roughly 50 TCs will pass. Is this normal?

  • Custom User Avatar

    It is a generator btw.

  • Custom User Avatar

    i used my solution for the first kata and adjusted it to fit the non adjacency rule . now it's passing all of the tests exepct like 5 of them that are like this example :
    input:
    [1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
    [1, 1, 0, 0, 0, 0, 0, 0, 1, 0],
    [1, 1, 0, 0, 1, 1, 1, 0, 1, 0],
    [1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [1, 0, 0, 0, 0, 0, 0, 0, 1, 0],
    [0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    after running the code :
    [4, 3, 1, 0, 0, 0, 0, 0, 0, 0],
    [4, 3, 0, 0, 0, 0, 0, 0, 2, 0],
    [4, 3, 0, 0, 3, 3, 3, 0, 2, 0],
    [4, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [1, 0, 0, 0, 0, 0, 0, 0, 1, 0],
    [0, 0, 0, 0, 2, 2, 1, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

    as you can see its prioritizing bigger ships first wich doesnt work in a minority of the cases.
    any suggestions on how i should assign ships when they are next to each other

  • Custom User Avatar

    I am struggling with this kata quite a bit. I have a very verbose and not so elegant solution that seems to be passing the vast majority of test cases.

    Now I think the error that im running into "Must return true if ships are touching" has to do with the priority that i use when removing ships. I start by removing the 4 cells, then 3, and then 2... however I have noticed that there are cases in which there can be multiple possible battleships and cruisers.

    so I guess my question is, is backtracking required to solve this kata?

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    I'm confused as to why it knows c represents characters in the strings

  • Custom User Avatar

    Python random tests is very bad: return True can pass the random tests after some repeated submissions. See this

  • Custom User Avatar
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
  • Custom User Avatar

    python, inadequate random tests:

    my incorrect solution often passes tests

    I'd publish and link it but cw doesn't feel like publishing it. it is however my latest submission, so if you click View Solution on this post, that's the incorrect solution.

  • Loading more items...