Ad
  • Custom User Avatar

    calculate_angle(0,45) = 112 (right answer is 111.5)

    calculate_angle(10,3) = 77 (right answer is 76.5)

    calculate_angle(7,19) = 105 (right answer is 105.5)

    calculate_angle(2,23) = 67 (right answer is 66.5)

    calculate_angle(10,47) = 41 (right answer is 41.5)

    Where is rounding logic?

  • Custom User Avatar

    Sorry if my variables' names mislead you (and me also) because there is interchanging x and u.

  • Custom User Avatar

    Thx! It is nice solution but it has problem with random tests (number rounding).

  • Custom User Avatar

    =================
    This is wall for author's head. Each brick is for each edge case!

  • Custom User Avatar

    Ruby tests have bad visibility.

    Testing for random group of 19 individuals
    You should find all the duplicates in random tests -  Expected: [#, #, #], instead got: [#, #, #]
    

    There are several solutions for this problem and 4kyu author must know one of them.

  • Custom User Avatar

    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.

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    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].

  • Custom User Avatar

    In the description author doesn't write that direct simulation of queue is pointless.

  • Custom User Avatar

    Guys, you overuse extreme conditions!