Ad
  • Default User Avatar

    cannot be changed anymore

  • Default User Avatar

    right? i test it too. it not work with last test

  • Default User Avatar

    Doesn't work for:
    $this->assertEquals([], solution(""));

  • Custom User Avatar

    strlen counts ç,ş,ü,ğ as 2. so its better to use mb_strlen or convert it to an array then count.

  • Custom User Avatar

    Hi, as was mentioned in task description, we need iterate until Math::PI - our_calculated > epsilon. You may, possible getting your iterations count by some manipulations with epsilon itself - e.g. take reverse number of it, or so on.

  • Default User Avatar

    You can use:
    (r * 1e10).round / 1e10
    where r is your result with all its decimals (as long as r is correct...).

  • Custom User Avatar

    Hi,

    I tried to solve this kata in Crystal. Unfortunately I have two issues:

    1. using the round 10 doesn't work as expected. All 16 decimals are returned then:
      expected: [10, 3.0418396189]
      got: [10, 3.0418396186909367]
      on the other hand using round 9 returns a value as expected:
      expected: [10, 3.0418396189]
      got: [10, 3.041839619]
      It's just my third kata in Crystal, so I don't know if I'm doing something wrong or it's just a bug in Crystal
    2. Even if rounding up to ten decimals would work as expected (for me) there is still a difference. Maybe it's due to floating point precision stuff ...?
      a) first test
      expected: [10, 3.0418396189]
      got: [10, 3.0418396186909367]
      b) second test
      expected: [100, 3.1315929036]
      got: [100, 3.1315929033839542]
      c) thrid test
      expected: [1000, 3.1405926538]
      got: [1000, 3.1405926539827576]
      d) fourth test
      expected: [10000, 3.1414926536]
      got: [10000, 3.1414926533677505]

    Any ideas?

    Thanks in advance

  • Custom User Avatar

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

  • Custom User Avatar

    I liked this one as well. Interesting how everyone has solved it so far.

  • Default User Avatar

    I agree with comments of Joshua B. Should be a higher grade Kata.

  • Default User Avatar

    Definitely agree, spot on with your comments.

  • Custom User Avatar

    I was wondering if a 7th kyu grade is skilled enough to solve this kata this way, as it is a beginner's grade.
    My expectation has been (from a java point of view):
    8th kyu -> brute force solution with simple type int
    7th kyu -> brute force solution with BigInteger (for I have to use the object's methods and constants)
    6th kyu -> performing a bit-wise operation for enhancement

    What do you think?

  • Custom User Avatar

    Why not adding a link to mathworld ( http://mathworld.wolfram.com/Determinant.html ) inside the kata description for some theory background about determinants?

  • Custom User Avatar

    Ah, I see. No problem, just would've been nice...err naughty...nevermind ;-)

  • Custom User Avatar

    Once a kata has 500 completions it becomes locked from edits.

  • Loading more items...