Ad
  • Default User Avatar

    Query length should not be less than or greater than 2. If it is, throw error.

  • Default User Avatar

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

  • Custom User Avatar

    Добрый день!
    Условия у данной Ката не отражают суть задачи.
    Поэтому решил написать данное пояснение, возможно кому-то поможет не ломать голову.

    1. На самом деле описание следующее:
      У вас есть гипотенуза и катет в прямоугольном треугольнике.
    • est - оцениваемое расстояние от полицейского до дороги (катет в треугольнике) - 1 расчет
    • act - фактическое расстояние от полицейского до дороги (катет в треугольнике) - 2 расчет
      readings - содержит 4ре значения.
      const [[distance1, time1], [distance2, time2]] = readings;
    • distance1 - дистанция от радара до автомобиля (1 замер)
    • time1 - время (1 замер)
    • distance2 - дистанция от радара до автомобиля (2 замер)
    • time2 - время (2 замер)
    • timeDif - (time1 - time) - не может быть отрицательным значением (используется для расчета обоих расстояний
      Есть два подхода, чтобы учесть данное условие:
      Обратите внимание, что ваш код должен быть способен обрабатывать показания, передаваемые в функцию в любом порядке.
      Можно вернуть модуль числа при расчетах или просто изменить порядок элементов массива (distance1 > distance2)

    На всякий случай формула прямоугольного треугольника: (A2 + B2 === C**2) (A/B - катеты) (C - гипотенуза)
    Только нужно не забывать, что нам нужно относительное значение и в километрах в час.

    Good day!
    The conditions of this Kata do not reflect the essence of the problem.
    Therefore, I decided to write this explanation, perhaps someone will help not to break his head.

    1. Actually the description is as follows:
      You have a hypotenuse and a cathetus in a right triangle.
    • est - estimated distance from the policeman to the road (the cathetus in the triangle) - 1 calculation
    • act - actual distance from the policeman to the road (the cathetus in the triangle) - 2 calculations.
      readings - contains 4 values.
      const [[distance1, time1], [distance2, time2]] = readings;
    • distance1 - distance from the radar to the car (1 measurement)
    • time1 - time (1 measurement)
    • distance2 - distance from radar to car (2nd measurement)
    • time2 - time (2nd measurement)
    • timeDif - (time1 - time) - cannot be a negative value (used to calculate both distances).
      There are two approaches to account for this condition:
      Note that your code must be able to handle readings passed to the function in any order.
      You can return the modulus of the number in the calculation, or you can simply change the order of the array elements (distance1 > distance2)

    Just in case, the formula for a right triangle: (A2 + B2 === C**2) (A/B - cathetes) (C - hypotenuse).
    Only we need to remember that we need a relative value and in kilometers per hour.

    P.S. please explain in the problem that you have an angle to the road of 90 degrees (For est and act this is a very good explanation).

  • Custom User Avatar
    1. Bump. Completely broken tests.
    2. Extremely cryptic description.
    3. Worst kata experience ever (after solving 6500 ones...)
  • Default User Avatar
  • Default User Avatar

    I seem to be getting funny errors despite having solved this questions, any tips please?

  • Custom User Avatar

    Hello, I'm stuck on the solution of this Kata.
    Basically I've solved, just I don't understand what kind of error this Kata expects from:
    I used // throw new Error(""); but it seems to not be the solution expected by the author so any tips/ suggestion would be helpful

    cheers

  • Default User Avatar

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

  • Custom User Avatar

    Awesome Kata! Thanks!

  • Custom User Avatar
  • Default User Avatar

    Added by someone.

  • Custom User Avatar

    the description should use language specific code blocks (or better, something language agnostic)

    note: author is inactive.

  • Custom User Avatar

    In JS solution :
    Test case does not meet description : speedError(8,2,[[5,1.82 ],[5,0.48]])

    Value 8 is bigger then ~5.
    Making radar position not perpendicular to road.

    Tested some aprooved solutions and this breaks pythagorean calculations.
    Math.sqrt(55 - 88) => NaN.

    I liked this kata but need some improvements.

  • Default User Avatar

    This kata caused me a lot of frustration but ultimately it was all down to a stupid error on my part. Since passing though, I've learned more JavaScript vocabulary and syntax from this kata than any JS kata I've done so far. So thank you very much for that!

  • Default User Avatar

    Okay, thanks for clearing it up.

  • Loading more items...