Ad
  • Custom User Avatar

    8 years old and only 12 solved this thing?
    Very curious of what I'm getting into. :-)

  • Custom User Avatar

    speeling error:

    we will record it's readings

    * its

  • Custom User Avatar
  • Custom User Avatar

    expected false to be true

    Is not a very useful message!

  • Custom User Avatar

    thank you very much, I did need to scroll all the way to the right for crucial information :)

  • Custom User Avatar

    I encountered the exact same problem. After re-reading the Description however, I discovered that the range value represents the tolerance for each testpoint in %. My original solution didn't treat the range values as percentages but as absolute values. BTW: You have to scroll the description all the way over to the right to see it (due to the length of the "javascript const references" example to find this detail).

  • Custom User Avatar

    WTF: how on Earth is value 3 on position 1 outside of range 2.01 - 1.5 and 2.01 + 1.5 ??????

    references ->
    type: 'YNAOZ-54',
        voltages: [ 10.75, 2.01, 1.98, 5.52, 9.67, 8.67, 9.76 ],
        ranges: [ 1.5, 1.5, 3, 0.5, 0.1, 0.3, 0.5 ]
        
    test case ->
    {
     ...
    },
    {
        type: 'YNAOZ-54',
        voltages: [10.75,3,1.98,4,9.67,8.67,9.76]
      }
    
    expected ->
    positions: 1[1,3]
    
  • Custom User Avatar

    Is this all the specs we get for type?

    type: 'M-11-8/20', // type of the device, a string
    
    • how do we parse a device?
    • how do we parse test points?
    • how do we know what is good and what is bad?
  • Custom User Avatar

    Enjoyable challenge!

  • Custom User Avatar

    i got errors like:

    Expected 982.2689999999999, got -982.2689999999999 (- x +740.202- 121.427 +437.24 -88.982 - 698.946+714.182=0)

    this is disappoint me because if u calculate it will be:

    - 982.2689999999999 +740.202- 121.427 +437.24 -88.982 - 698.946+714.182 = 1.1368683772161603e-13

    but if u (u know) fix it to 982.269 its will be the right answear
    so why do not just return 982.269 instead of 982.2689999999999 ?

  • Custom User Avatar

    the passed function may handle only one argument or several

    Or none at all! This is intentional, sum([1,2,3], [4,5,6], [7,8,9], () => 1) => 3 is correct. Even sum([1,2,3], () => Math.random()) is a correct usage of sum. The direct analogy is something like [1,2,3].map(() => 1) => [1,1,1]. My guess was that examples #2 and #3 perfectly clarify this behaviour. Do you think I need to explicitly state this in the description?

  • Custom User Avatar

    Hi, I agree that it is not clear from the description that the default value must be 0, especially in a case like sum([], () => 12345), I will update the description. Could you elaborate the "one cannot always do the task as explained" a bit further, probably by providing some examples?

  • Custom User Avatar

    Description is bad. The function needs to do different things if there is only one array, the passed function may handle only one argument or several (so one cannot always do the task as explained), if we receive a single emtpy array, we have no idea of what should be the default value...

  • Custom User Avatar

    Yes, Node v10.x is set by default.
    Well, I'll have a look at it once again later.

  • Custom User Avatar

    Hi catchaser, yes, you are right, the result must be 68. I don't understand why you are seeing this (all test cases expect "0"), I just checked and everything works fine for me. Probably something wrong with codewars' test runners? Are you using Node v10.x?

  • Loading more items...