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.
calculate_angle(0,45) = 112
(right answer is111.5
)calculate_angle(10,3) = 77
(right answer is76.5
)calculate_angle(7,19) = 105
(right answer is105.5
)calculate_angle(2,23) = 67
(right answer is66.5
)calculate_angle(10,47) = 41
(right answer is41.5
)Where is rounding logic?
Sorry if my variables' names mislead you (and me also) because there is interchanging
x
andu
.Thx! It is nice solution but it has problem with random tests (number rounding).
=================
This is wall for author's head. Each brick is for each edge case!
Ruby tests have bad visibility.
There are several solutions for this problem and 4kyu author must know one of them.
This practice is tipical for polymorphic functions. Usualy polymorphic functions differ argument tuple but this fucntion is polymorphic because has two diffirent definitions for n > 0 and n < 0.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Why is expand(1,5) = [109601, 40320] although 109601 (numerator) contains 6 digits?
exp(1) has continued fraction (see Wolfram Alpha) [2;1,2,1,1,4,1,1,6,1,1,8,1,1,10....]
[2;1,2,1,1,4,1,1,6,1,1,8,1,1] = 49171/18089
[2;1,2,1,1,4,1,1,6,1,1,8,1,1,10] = 517656/190435
IMHO, [49171,18089] is more appropriable for expand(1,5)
If you want irreducible fraction only Taylor series then this moment must be designated in the description.
Also exp(1.85) = 6.359819523 but expand(1.85,60) = [
1255640015507986459344754396106984611112931890102125595005801691,
205688069665150755269371147819668813122841983204197482918576128].
125...1 / 205...8 = 6.1045
Nearest irreducible fraction of Taylor series is [
17212490183856113080811676174541242934582010358766327687597249
2706443181710666438004021657600000000000000000000000000000000].
In the description author doesn't write that direct simulation of queue is pointless.
Guys, you overuse extreme conditions!