Ad
  • Custom User Avatar

    OP solved it, closing

  • Custom User Avatar

    TS did it, no question

  • Custom User Avatar

    TS did it, no issue

  • Custom User Avatar

    locationsToFlood.AddRange(Flood(image, locationsToFlood[0], waterLevel, (row, col))); Your timeout problem in this row. Don't ask me how I found it

    ~~~~~________~~~~~
    -..'`      .'~~~~~
    o/o`-..__.'~~~~~~~
    o|o      `xx_.~~//
    o|o    T   |||<|||
    o|o       .'-'~~\\
    _\_...-``'.~~~~~~~
    ~~`._______`.~~~~~
    

    Such doublehits are not passing your sol

  • Custom User Avatar

    locationsToFlood.AddRange(Flood(image, locationsToFlood[0], waterLevel, (row, col)));
    Your timeout problem in this row. Don't ask me how I found it

  • Custom User Avatar

    Try to attempt few times with initial solution. If you see more than one submarine, it means that previous are pass the tests. Only last one pic not pass. I tried your previous code, and yes, it working in some cases, but not cover all tests. Read again cases in description, maybe you miss something. Add one more module to print YOUR pic AFTER test

  • Custom User Avatar

    I am not sure that got your question. Join names without commas and don't change their order. If you need more perfomance, use stacks and queues instead of lists, use hashset to not repeat coordinates.

  • Default User Avatar

    Hello, you are so close with the code you have here. The trouble is not large input values. For example, consider what happens with input of 10. The trouble is that your logic is slightly off when the product is not equal to prod. Think about why that is and I think you will see it.

  • Custom User Avatar

    a quine is a program whose the output is the program/code itself.

  • Custom User Avatar

    Closing this one.

  • Custom User Avatar

    Your recursive method for finding Fibonacci numbers, you build the series from scratch each time you call it.

  • Default User Avatar

    Hi - first of all, please use spoiler flag any time you post code; everyone can see it and it may spoil the kata for other people.

    Secondly - this kata is notorious on Codewars for people seemingly not understanding what to do. Every week someone posts basically the exact same comment about "Why do I get 1064 when answer expects 1074".

    The simple reason is: you are calculating "locally" the maximum element, row by row, as you move down. However, the "global" maximum is not the same thing: consider this example:

            2
          1   99
        0   3   77
    8000  6   12  140
    

    with your approach you will go down the right-hand "branch" of the pyramid because 99>1, and 77>3, and 140>12 so you will get an answer of 2+99+77+140.

    But the maximum possible value involves making "bad choices" at first: 2+1+0 but then you get to add the huge value 8000, which gives you a total of 2+1+0+8000 which is greater than your solution 2+99+77+140.

    Also, scroll down and read the other comments that explain the same question already since 7+ years:

    posted 2hrs ago

    comment from 3 weeks ago

    comment that links to even more comments

  • Custom User Avatar

    Read the post below yours. You have the exact same problem.