6 kyu

Biggest of the Smallest of the Biggest of the...

Description
Loading description...
Algorithms
Arrays
  • Please sign in or sign up to leave a comment.
  • nivida Avatar

    This comment has been hidden.

  • RealKenshiro Avatar

    There may be duplicate integers inside the array, in which case the duplicate integers that come first are prioritized. When taking "the biggest" of [4,5,4,4], your code should return [4,5], not [5,4]

    The prioritized thing is not clearly defined. Actually, the array has be sorted differently, depending on the type smallest (by values then by largest indexes prioritized) or biggest (by values then by smallest indexes prioritized)

  • JohanWiltink Avatar

    This comment has been hidden.

  • Blind4Basics Avatar

    What the "biggest/smallest" of an array means is described in the intro of the description, so make sure to read through the whole thing.

    Except it is NOT. Examples are not specifications. What you give there are examples. I don't wanna have to read your mind when I see random tests failing while the rules aren't explained properly (edit: btw, this means you don't have enough fixed tests anyway).

    For instance, I'm still waiting for an explanation of the input I gave below. According to what MAY be deduced from your non specifications, I don't see how the expected output could be right. So you need to give actual specifications.

    note: I don't see the content of the issue below so, sorry if it's about the same thing.

    Cheers

  • Madjosz Avatar

    Reference solution is still wrong. The most blatant random test I am failing is

    [ 5512, 0, 2 ] "the smallest of the biggest of the smallest of the biggest"
    

    expected [ 2 ] to deeply equal [ 0 ]

    Since we have to work from the back of the string:

    • biggest: [5512, 2]
    • smallest: [2]

    So where does the expected [0] come from? It gets filtered out in the first iteration.

  • Blind4Basics Avatar

    Hi,

    • The description is especially unclear about what actually means "biggest/smallest" here, and about how the data should be put in the resulting array. Currently, the task is to read the mind of the author, which is never a good sign.

    • description: the biggest of [2,9,8,5,6,3,4,7,1] is [9,8,5,6,7], the smallest of that is [5,6], and the biggest of that is [6]. -> [9], not [6]

    • random tests:

      • you still have some logs that shouldn't be there, apparently (see below: 2 logs in the same it block

      • I don't get why the below is wrong:

        [
          5, 3, 4, 1, 6,
          8, 7, 4, 5, 5,
          8
        ]
        the biggest of the biggest      <<< those logs shouldn't appear here
        
        
        [
          4702,    5,   78, 21,   80,    3,
             4, 4683,    8,  1,    6, 7251,
             8,    7, 6490,  4, 3228, 8460,
             5,    5,  133,  8
        ]
        the biggest of the biggest of the smallest
        expected [ 8, 8, 7 ] to deeply equal [ 8, 7, 8 ]
        
    • arr: 4702,5,78,21,80,3, 4, 4683,8,1,6, 7251,8,7, 6490,4, 3228, 8460,5,5,133, 8

    • small: 5,3,4,8,1,6,8,7,4,5,5 (last 8 isn't there, is it?)

    • big: 5,8,6,8,7,5

    • big: 8,8,7

    => ??

    cheers

  • Voile Avatar

    The description only mentions that arrays with length 1 should be preserved at the start, but the random tests expect that this also stays the same during all the operations. aka this test is needed:

    assert.deepEqual(ofThe([1,2],"the smallest of the smallest of the biggest"), [2]);
    
  • B1ts Avatar

    Reference solution is calling the user function.

  • B1ts Avatar

    Random tests are vulnerable to input modification. You should compute the expected value first, before calling assert (which runs user function first)

  • Fbasham Avatar

    Looks like changes have been made, but the status of this kata is that it's still in draft. Are you ready to publish again? I have a working solution per your changes.

  • Unnamed Avatar

    Note that if the length of the array is odd, then the biggest part takes the middle number.

    assert.deepEqual(ofThe([7],"the smallest of the biggest of the biggest"), [7]);

    Why doesn't it become [] after "the smallest"?

  • B1ts Avatar

    From random tests:

    ofThe([ 3, 3, 3, 7, 193, 234, 6, 2, 0, 6, 4547 ], "the biggest")
    expected [ 7, 193, 234, 6, 6, 4547 ] to deeply equal [ 7, 6, 193, 234, 6, 4547 ]
    

    How is a 6 expected to come before 234 ?

  • B1ts Avatar

    Your random testing is problematic. I cannot see any console logs being grouped with a particular test, they're all lumped in together.