• 'alr approved some time ago'

  • 'alr approved some time ago'

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

  • I had to make my sort stable to pass the example tests.

    I'm not debugging anything with the current random tests sized $RIDICULOUS, but I remain firmly unconvinced the problem is with my code.

    I am using Node v8.x.

  • The reference solution as used in the random tests uses the native JS [].sort, which is unstable.

    Node's sorting is already stable since v7.0.

    Just disable v6 and it should be fine I think?

  • The reference solution as used in the random tests uses the native JS [].sort, which is unstable. That means

    keep initial order of items of the same type

    is not guaranteed in the reference solution.

    I think I'm running into this: I pass the Example tests, I take great care to sort stably, I fail the Submit tests, but I cannot debug because I'm f***ing drowning in data.

    I'm not 100% sure this is a kata issue, but I'm marking it as such because I am 99.99% sure.

  • The Submit tests are useless for debugging because of sheer data overload.

    Include random tests of smaller samples as well, because not all bugs can be fixed by training on the Exemple tests.

  • The Sample Tests block in the actual tests are actually random tests, so it shouldn't be described as sample tests.

    Speaking of which, fixed tests should be added either.

  • Why is the return type a string of an array of ints joined together? Can't you just let us return the array?

  • Example is not a replacement of a clear definition. Please provide a definition that can actually be understood.

  • Hi!

    ex: [
    { r: 1, t: 1, i: 1},
    { r: 1, t: 1, i: 2},
    { r: 1, t: 1, i: 3},
    { r: 1, t: 2, i: 4},
    { r: 1, t: 2, i: 5},
    { r: 1, t: 2, i: 6},
    { r: 1, t: 3, i: 7},
    { r: 1, t: 3, i: 8},
    { r: 1, t: 3, i: 9},
    { r: 1, t: 4, i: 10},
    { r: 1, t: 4, i: 11},
    { r: 1, t: 4, i: 12}
    ]

    sorted: [
    { r: 1, t: 1, i: 1 },
    { r: 1, t: 2, i: 4 },
    { r: 1, t: 3, i: 7 },
    { r: 1, t: 4, i: 10 },
    { r: 1, t: 1, i: 2 },
    { r: 1, t: 2, i: 5 },
    { r: 1, t: 3, i: 8 },
    { r: 1, t: 4, i: 11 },
    { r: 1, t: 1, i: 3 },
    { r: 1, t: 2, i: 6 },
    { r: 1, t: 3, i: 9 },
    { r: 1, t: 4, i: 12 }
    ]

    If you look at t, you'll see that there're 4 different types (1, 2, 3, 4) x3 of each, so they should be sorted as following 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4.
    If we mark each item of the same type by a letter, we will get (1a, 1b, 1c) and so on, and final sorting should look as following got types: 1a, 2a, 3a, 4a, 1b, 2b, 3b, 4b, 1c, 2c, 3c, 4c.

    output: '1:4:7:10:2:5:8:11:3:6:9:12';

  • I'm sorry, I don't get it.

    1. Within each room group order all items so that they're alternating with each other;

    What should be alternating?

    1. Make sure, that types have ascending order;

    If condition 3 is to be satisfied only after 1 and 2, "make sure" may not be the best expression.

    1. When alternating

    See 2.

    At least I suppose the order is to be according to (1), then (2), then (3), then (4). Or should they be true all at the same time?

    The example does not clarify things for me either.

  • Replaced test cases. Thanx a lot! You're great! :)

  •   const tCnt = rand(100, 80);
      
      for(let i=0; i < tCnt; i++) {
    

    There are no need to set random times of cases for such trivial task
    We usually do fixed 100 times

    Also

      for(let i=0; i < tCnt; i++) {
        it("Tests", function() {
    

    there are no need to generate many it blocks since you are not providing any useful message in the label

    And

    Test.assertEquals(sortData(testData), mySortData(testData));
    

    by doing this, users' solutions are free to mutate the input

    So it should be rewrite like

    describe("Sample tests", function() {
      it("Tests", function() {
        for(let i=0; i < 100; i++) {
          const testData = genTestData();
          const excepted = mySortData(testData);
          Test.assertEquals(sortData(testData), excepted);
        }
      });
    });
    
  • Loading more items...