Ad
  • Custom User Avatar

    Well, I got the answer but it took me a bit of time to understand why my answer is right :P

    The 10 chair example wasn't enough so I used that to visualize the answer for 1 chair, 2 chairs, 3 chairs, 4 chairs, 5 chairs.
    Using the given rules, a pattern comes about and that was it.

  • Custom User Avatar

    For me the most difficult part was trying to understand the description.

    The descriptions should be simple, something like:

    Player starts at a given position & moves twice the value of the dice roll.

    Calculate the final position.

  • Custom User Avatar

    Because of the "g" modifier that performs a global match; i.e. continues matching until the end of string.
    Each time it finds a match, it repeatedly returns it to the replace function for processing.
    And since this match is inside the first capture group, it can be accessed as $1.

  • Custom User Avatar

    For the given conditions, wasn't 6 kyu at all.
    But fun none-the-less.

    Thanks :)

  • Custom User Avatar

    Finally! After refining my logic multiple times, I ended up with my initial solution but with a very small change which reduced my execution time dramatcially!

    In the end, I really enjoyed this kata.
    Thanks for sharing :)

  • Custom User Avatar

    My logarithm base is a bit weak. Could you please explain how you got to this solution?

  • Custom User Avatar

    It would look like:

    divisors       [ 1  3 ]
    clan 
    1,2,4,5,7,8,10   Y  N
    3,6,9            Y  Y
    
  • Custom User Avatar

    Thanks, still took awhile to figure.

    For others, another example would be:

    divisors [ 2  3  4 ]
    number               clan
    1          N  N  N   A
    2          Y  N  N   B
    3          N  Y  N   C
    4          Y  N  Y   D
    5          N  N  N   A
    6          Y  Y  N   E
    

    [1, 5] are in the same "clan" because they exhibit similar individual "feelings" to the same "group" of divisors.
    The rest are in their own "clan" because they don't share the same individual polarity.

    Kinda like, say when there are 2 judges:

    • CASE 1: You like all of them, and I like all of them. Then we can be friends and talk about how cool them judges are :)
    • CASE N: You like only the first judge and I like only the second judge, then we can't be friends :(
    • We make our own solemn group and wait for someone to join us
    • Later, when Bob comes along and says he likes only the first judge too, then Bob joins your group (and you both giggle about) while I keep waiting for someone to share my "feelings"
  • Custom User Avatar

    I am finding it difficult to understand this kata.
    Can someone please explain how 2 numbers can be friends here?

  • Custom User Avatar

    This kata showed me the difference in speed between a for-in and a for-each (Swift).

    • (0...n).forEach() was much slower than for i in (0...n)

    All I had to do was use the latter to drop to approx 8500ms; still can be optimized but darn it, a time-out on the solution is more frustrating :D

    Thanks for this kata :)

  • Custom User Avatar

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

  • Custom User Avatar

    TDD blows my mind sometimes! This solution came in, like, a snap and I was like wtf!?
    But now that I think about it, it makes so much sense!

  • Custom User Avatar

    Requires random tests

  • Custom User Avatar

    This was a fun kata.
    Thanks :)

    PS: Looks like most have done a brute-force to eliminate only one ! at a time.

  • Custom User Avatar

    This was fun. However, out of all katas I have seen so far, this one seriously needs some random tests.
    Also, this felt more like a 6 kyu rather than a 5 kyu.

  • Loading more items...