Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
In this case, the iterative approach to solving the problem will be correct.
Recursion will not be enough 12000 ms to process all tests.
Regarding the operation of portals. I would expand the description to something like this:
Portal(4, 2);
0000594 ---> 0594495 ---> 0059535 ---> 0005625 ---> 0000675
Regarding mirror operation with negative numbers:
The mirror can work with negative values.
It just doesn't take into account the "-" sign and will also return a negative value.
-594 ---> -594495
Few tips
It is also worth considering the performance of your internet connection and the speed of your PC.
Because sometimes it can happen that tests are not performed due to system overload.
In most operations, it is the numbers that are used.
So I suggest using unary + when returning a number at each operation to avoid string values.
For me personally, this kata turned out to be extremely difficult to implement,
but also gave me much-needed experience in working with some methods.
Good luck coding!
Добрый день!
Условия у данной Ката не отражают суть задачи.
Поэтому решил написать данное пояснение, возможно кому-то поможет не ломать голову.
У вас есть гипотенуза и катет в прямоугольном треугольнике.
readings - содержит 4ре значения.
const [[distance1, time1], [distance2, time2]] = readings;
Есть два подхода, чтобы учесть данное условие:
Обратите внимание, что ваш код должен быть способен обрабатывать показания, передаваемые в функцию в любом порядке.
Можно вернуть модуль числа при расчетах или просто изменить порядок элементов массива (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.
You have a hypotenuse and a cathetus in a right triangle.
readings - contains 4 values.
const [[distance1, time1], [distance2, time2]] = readings;
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).