Ad
  • Custom User Avatar

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

  • Custom User Avatar

    As I know all correct input data have only one possible solution.
    As for 1010 question is where to take input sample for 1010?

  • Custom User Avatar

    I can't create a generator of random solution, which can be used for random generating test.
    I can't find regularity and think up an quick algorithm.
    Now it takes about 50-300Ms for one new correct random clues. I think it is not enought for tests.
    But I can generate in advance any amout of solutions
    For example https://github.com/ekaruk/codewars/blob/master/Scrapers.txt
    As I understand, these are right examples of Skyscrapers and clues with one solution.
    I use little brute force for generation, so time of generation is not fixed.

    You can add hundred solutions and use any random 5-10 from these fixed solutions for every test

  • Custom User Avatar

    Such problems are very well solved step by step.
    Decision one.
    Therefore on each step we can improve the last decision without brute force.

  • Custom User Avatar

    Interesting Kat series (44; 66; 77).
    I am proud of myself :)
    The first solution for 4
    4 works with the minimum changes in indexes both on 66 and on 77.
    For the size 7*7 calculation lasts on PC 54 milliseconds so possible will work also for the bigger size.
    Plus 1 Kyu for one solution :)

  • Custom User Avatar

    One of options.
    It is possible to add 20 in advance generated tests, but to check every time, for example, any random 5 of them.

  • Custom User Avatar
  • Custom User Avatar

    Interesting approach. Two identical kata with different complexity
    At first I solved it in easier version https://www.codewars.com/kata/52756e5ad454534f220001ef
    The solution of a Performance version kata was much shorter and 50 times faster, than the decision it in easier version

  • Custom User Avatar

    Thank you.
    The first time I haven't understood the instructions correctly

  • Custom User Avatar

    I have get in Java version result of test
    expected: <a[c]> but was:<a[]>
    Result must be String. What does it mean a[c]? String "a" or "c" ?
    Correct wrong result usually look like this : expected:<[ab]> but was:<[abc]>

  • Custom User Avatar

    Very interesting Kata.
    My first solution was too long.
    It has given a reason to think again and write other solution.
    Thank you :)

  • Custom User Avatar

    Now I isn't get this error.
    I think it is fixed;
    Now I get error "Execution Timed Out (20000 ms)". It is problem of my algoritm, not problem of test.

  • Custom User Avatar

    Thanks for an explanation.
    It seems that error of tests really such. Missed not every time point last before finish. Different points.
    Zero distances not a problem. They shouldn't influence calculation in any way.

    I have test again
    result of test
    your path: [up, up, right, up, up, up, up, left, left, left, up, left, up, up, up, up, up, up, up, up, up, up, up, left, left, left, up, up, up, up, up, up, up, left, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, left, left, up, left, left, up, left, left, left, left, up, left, left, up, up, up, up, up, up, up, up, up, up, right, up, right, up, right],
    cost=2288 should be somehting like
    [up, up, right, up, up, up, up, left, left, left, up, left, up, up, up, up, up, up, up, up, up, up, up, left, left, left, up, up, up, up, up, up, up, left, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, up, left, up, up, left, left, left, left, left, left],
    cost=2263 expected:<2263> but was:<2288>

    Real cost of 2 ways 2312
    My way has more steps but same cost
    (last part is different in sample)

    up:5;up:22;right:16;up:7;up:38;up:49;up:14;left:23;left:45;left:34;up:8;left:1;up:10;up:33;up:20;up:20;up:35;up:76;
    up:20;up:33;up:28;up:76;up:13;left:18;left:17;left:41;up:4;up:84;up:2;up:6;up:4;up:37;up:34;left:14;up:22;up:38;up:62;
    up:24;up:33;up:93;up:42;up:32;up:4;up:51;up:40;up:28;up:30;up:37;up:76;up:53;up:19;up:0;up:24;
    left:36;left:5;up:29;left:20;left:30;up:53;left:20;left:2;left:53;left:19;up:16;left:15;left:27;up:10;up:11;up:44;up:31;up:3;up:78;up:24;up:22;up:33;up:0;right:23;up:78;right:0;up:4;right:31;
    2312

    up:5;up:22;right:16;up:7;up:38;up:49;up:14;left:23;left:45;left:34;up:8;left:1;up:10;up:33;up:20;up:20;up:35;up:76;
    up:20;up:33;up:28;up:76;up:13;left:18;left:17;left:41;up:4;up:84;up:2;up:6;up:4;up:37;up:34;left:14;up:22;up:38;up:62;
    up:24;up:33;up:93;up:42;up:32;up:4;up:51;up:40;up:28;up:30;up:37;up:76;up:53;up:19;up:0;up:24;
    up:81;up:6;up:39;up:11;up:50;up:5;up:4;up:68;up:4;up:66;up:18;up:7;up:21;left:39;up:35;up:41;left:39;left:20;left:81;left:22;left:29;left:31;
    2312

    (sample of date on the same githab with first sample)

  • Custom User Avatar

    '''java
    int[][] tollMap3 = {
    {50,58,98,44,88,31,33,14,30,58,79,40,28,80,35,9,54,30,78,74,42,37,32,16,93,71,86,56,71,78,61,51,2,86,43,},
    {19,87,95,18,59,17,25,14,86,98,4 ,93,20,64,8, 34,29,13,57,81,14,32,36,87,31,57,6,21,91,55,95,99,67,84,31,},
    {68,46,93,17,69,75,89,33,0 ,33,57,72,23,15,22,11,85,67,63,57,29,38,81,57,41,83,40,40,22,9,80,88,27,7,99,},
    {23,64,77,63,48,54,49,52,62,0 ,93,95,20,92,25,24,80,89,74,50,24,57,88,46,89,75,33,48,54,68,18,46,22,30,83,},
    {37,4 ,41,76,85,63,2 ,47,69,44,19,23,25,11,58,66,98,8,49,86,24,34,7,94,46,37,53,59,58,58,88,23,3,7,15,}};
    Point start3 = new Point(1, 17), finish3 = new Point(4, 13);
    System.out.println(cheapestPath(tollMap3, start3, finish3));
    '''

  • Custom User Avatar

    In Java version may be incorrect calculating of tests result
    Check, please.

    Sample from Test result
    your path: [left, left, left, down, left, left, down, down, right], cost=164
    29 34 8 22 15 23 20 25 11
    should be somehting like
    [left, left, left, down, down, down, left], cost=131 expected:<131> but was:<164>
    29 34 8 22 25 58 11
    Both cases sum 187, not 131 and not 164
    Full array of data
    https://github.com/ekaruk/codewars/blob/master/Finder.txt