Ad
  • Custom User Avatar

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

  • Custom User Avatar

    Hello there!

    Can you see my code? What's wrong with rounding my result?

    This is what I have:

    Expected: [8.6667, 6.6667]

    Actual: [8.6667, 6.6667]

    I can't see the difference, but my answer is 'incorrect' and tests are not passed.

  • Custom User Avatar
  • Custom User Avatar
  • Default User Avatar

    But there will still be cases where the string is longer than 140 characers (including whitespaces) and the hastag shorter than 140 characters - I think this should be added as a test case.

  • Custom User Avatar

    There are no need to round offsets since it only involved in the calculation not being results and increasing the deviation
    And you cannot make sure that someone calculate in this way

    Offset : [,,1]
    
    Offset[0] = round(1/3,3) == 0.333
    Offset[1] = Offset[0] + round(1/3,3) == 0.666
    

    Which is different with

    [0.333,0.667,1]
    

    Though this is not suitable for [,,1]: [0.333, 0.667, 1] in the desc, but you cannot make sure that deviation wouldnt make different by rounding offsets

  • Custom User Avatar

    Tunrns out it was my previous solution modified the input that case the not false problem
    Which means you should write tests in this way

    expected = referenceSolution(input)
    actual = userSolution(input)
    

    And another case

    {"duration":2135,"keys":[{"props":{"translateX":-97,"top":381,"skewX":67,"translateY":-445,"opacity":-361}},{"props":{"translateY":137,"skewY":483,"scaleY":-269,"rotateY":-310,"opacity":140}},{"offset":0.02,"props":{"scaleX":-405,"top":108,"skewY":-297,"skewX":479,"translateY":-182}}]}
    
    expected [ [ -445, 14.945 ], [ 137, 14.945 ], [ -182, 14.945 ] ] to deeply equal [ [ -445, 14.945 ], [ 137, 12.81 ], [ -182, 14.945 ] ]
    expected [ [ -361, 14.945 ], [ 140, 14.945 ] ] to deeply equal [ [ -361, 14.945 ], [ 140, 12.81 ] ]
    
  • Custom User Avatar
    expected { duration: 8007,
      opacity: 
       [ { value: 431, duration: 2508.86 },
         { value: 3, duration: 5017.72 } ],
      rotate: 
       [ { value: 190, duration: 2508.86 },
         { value: -159, duration: 5017.72 },
         { value: -14, duration: 240.21 },
         { value: 337, duration: 240.21 } ],
      scaleY: 
       [ { value: 133, duration: 2508.86 },
         { value: -390, duration: 5257.93 },
         { value: -398, duration: 240.21 } ],
      rotateY: [ { value: -130, duration: 2508.86 } ],
      skewX: 
       [ { value: 398, duration: 2508.86 },
         { value: -36, duration: 5017.72 } ],
      translateX: 
       [ { value: 428, duration: 5017.72 },
         { value: -418, duration: 2508.86 },
         { value: -127, duration: 480.42 } ],
      translateY: 
       [ { value: -496, duration: 5017.72 },
         { value: -34, duration: 2508.86 },
         { value: -178, duration: 240.21 },
         { value: 231, duration: 240.21 } ],
      left: 
       [ { value: -165, duration: 5017.72 },
         { value: 439, duration: 2508.86 },
         { value: 149, duration: 240.21 } ],
      scaleX: [ { value: 37, duration: 5017.72 } ],
      skewY: [ { value: -139, duration: 5017.72 } ],
      top: [ { value: 101, duration: 7526.58 } ],
      rotateX: [ { value: 5, duration: 7766.79 } ],
      scale: [ { value: 126, duration: 7766.79 } ],
      skew: [ { value: 161, duration: 8007 } ] } to be an object
    expected { duration: 8007,
      opacity: 
       [ { value: 431, duration: 2508.86 },
         { value: 3, duration: 5017.72 } ],
      rotate: 
       [ { value: 190, duration: 2508.86 },
         { value: -159, duration: 5017.72 },
         { value: -14, duration: 240.21 },
         { value: 337, duration: 240.21 } ],
      scaleY: 
       [ { value: 133, duration: 2508.86 },
         { value: -390, duration: 5257.93 },
         { value: -398, duration: 240.21 } ],
      rotateY: [ { value: -130, duration: 2508.86 } ],
      skewX: 
       [ { value: 398, duration: 2508.86 },
         { value: -36, duration: 5017.72 } ],
      translateX: 
       [ { value: 428, duration: 5017.72 },
         { value: -418, duration: 2508.86 },
         { value: -127, duration: 480.42 } ],
      translateY: 
       [ { value: -496, duration: 5017.72 },
         { value: -34, duration: 2508.86 },
         { value: -178, duration: 240.21 },
         { value: 231, duration: 240.21 } ],
      left: 
       [ { value: -165, duration: 5017.72 },
         { value: 439, duration: 2508.86 },
         { value: 149, duration: 240.21 } ],
      scaleX: [ { value: 37, duration: 5017.72 } ],
      skewY: [ { value: -139, duration: 5017.72 } ],
      top: [ { value: 101, duration: 7526.58 } ],
      rotateX: [ { value: 5, duration: 7766.79 } ],
      scale: [ { value: 126, duration: 7766.79 } ],
      skew: [ { value: 161, duration: 8007 } ] } to have keys 'duration', 'opacity', 'rotate', 'scaleY', 'rotateY', 'skewX', 'translateX', 'translateY', 'left', 'scaleX', 'skewY', 'top', 'rotateX', 'scale', and 'skew'
     Expected Actual
    expected [ { value: 431, duration: 2508.86 },
      { value: 3, duration: 5017.72 } ] to be an array
    expected [ { value: 431, duration: 2508.86 },
      { value: 3, duration: 5017.72 } ] to have a property 'length'
    expected [ { value: 431, duration: 2508.86 },
      { value: 3, duration: 5017.72 } ] to have a length of 2 but got 2
    expected [ [ 431, 2508.86 ], [ 3, 5017.72 ] ] to deeply equal [ [ 431, 2506.191 ], [ 3, 5020.389 ] ]
     Expected Actual
    expected [ { value: 190, duration: 2508.86 },
      { value: -159, duration: 5017.72 },
      { value: -14, duration: 240.21 },
      { value: 337, duration: 240.21 } ] to be an array
    expected [ { value: 190, duration: 2508.86 },
      { value: -159, duration: 5017.72 },
      { value: -14, duration: 240.21 },
      { value: 337, duration: 240.21 } ] to have a property 'length'
    expected [ { value: 190, duration: 2508.86 },
      { value: -159, duration: 5017.72 },
      { value: -14, duration: 240.21 },
      { value: 337, duration: 240.21 } ] to have a length of 4 but got 4
    expected [ [ 190, 2508.86 ],
      [ -159, 5017.72 ],
      [ -14, 240.21 ],
      [ 337, 240.21 ] ] to deeply equal [ [ 190, 2506.191 ],
      [ -159, 5020.389 ],
      [ -14, 240.21 ],
      [ 337, 240.21 ] ]
     Expected Actual
    expected [ { value: 133, duration: 2508.86 },
      { value: -390, duration: 5257.93 },
      { value: -398, duration: 240.21 } ] to be an array
    expected [ { value: 133, duration: 2508.86 },
      { value: -390, duration: 5257.93 },
      { value: -398, duration: 240.21 } ] to have a property 'length'
    expected [ { value: 133, duration: 2508.86 },
      { value: -390, duration: 5257.93 },
      { value: -398, duration: 240.21 } ] to have a length of 3 but got 3
    expected [ [ 133, 2508.86 ], [ -390, 5257.93 ], [ -398, 240.21 ] ] to deeply equal [ [ 133, 2506.191 ], [ -390, 5260.599 ], [ -398, 240.21 ] ]
     Expected Actual
    expected [ { value: -130, duration: 2508.86 } ] to be an array
    expected [ { value: -130, duration: 2508.86 } ] to have a property 'length'
    expected [ { value: -130, duration: 2508.86 } ] to have a length of 1 but got 1
    expected [ [ -130, 2508.86 ] ] to deeply equal [ [ -130, 2506.191 ] ]
     Expected Actual
    expected [ { value: 398, duration: 2508.86 },
      { value: -36, duration: 5017.72 } ] to be an array
    expected [ { value: 398, duration: 2508.86 },
      { value: -36, duration: 5017.72 } ] to have a property 'length'
    expected [ { value: 398, duration: 2508.86 },
      { value: -36, duration: 5017.72 } ] to have a length of 2 but got 2
    expected [ [ 398, 2508.86 ], [ -36, 5017.72 ] ] to deeply equal [ [ 398, 2506.191 ], [ -36, 5020.389 ] ]
     Expected Actual
    

    It's very annoying in the random test and no one can figure out what are different easily.

    Just do result.should.deep.equal(solve) is enough

  • Custom User Avatar
  • Custom User Avatar

    yes, for now it should return false

    I mean that maybe it would be better to merge such offsets, e.g.

    { offset: 0.5, props: { left: 100 } },
    { offset: 0.5, props: { top: 100 } }
    

    can be merged into

    { offset: 0.5, props: { left: 100, top: 100 } }
    

    but I'm still confused of cases from my previous reply;
    that's why I want this to return false

  • Custom User Avatar

    Um.. what do you mean by merge? This is the case to return false right?

  • Custom User Avatar

    Ofc you solution returned an object
    or i would see expected {...} to equal false

  • Custom User Avatar

    I can't resolve some cases. For example:

    { offset: 0.7, props: { left: 100 } }
    { offset: 0.7, props: { left: 200 } }
    

    How to merge matched left property correctly? I have no the only answer.

  • Custom User Avatar

    an empty object should be fixed for now and return false

  • Custom User Avatar
  • Loading more items...