Ad
  • Custom User Avatar

    (C#) In VS the random tests use \n but the tests defined by verbatim strings (i.e. @"...") use \r\n AFTER copying to VS.The codewars environment uses \n in both cases. Your solution should replace as first operation \r\n by \n:

    snapshot.Replace("\r\n","\n")
    In this case you cannot write: snapshot.Split(Environment.NewLine)
    
  • Custom User Avatar

    Also the "Geometry" tag might be helpful.

  • Custom User Avatar

    They don't necessarily arrive on the minute intervals. Your calculation is approximately correct, but not accurate enough.

  • Custom User Avatar

    To the serial downvoter, I will find out who you are, do worry about it.

  • Custom User Avatar

    Montecarlo is meant to time out. You need a more optimised solution. It doesn't hurt learning about Bayesian Statistics.

  • Custom User Avatar

    I assume I am missing something but I'm confused by the 18.75 value for the example. The boy arrives from 07:55 to 08:01 which is 7 different arrival times (55, 56, 57, 58, 59, 00, 01), the bus arrives between 07:58 and 08:02 giving 5 different arrival times (58, 59, 00, 01, 02). Therefore there are 7*5=35 total scenarios, of which 6 mean he will miss the bus:
    boy arrives at 07:59, bus arrives at 07:58,
    boy arrives at 08:00, bus arrives at 07:58 or 07:59,
    boy arrives at 08:01, bus arrives at 07:58, 07:59, or 08:00
    So 6 misses out of 35 total scenarios is 17.14% ?
    What am I missing?

  • 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

    The windows ansi (e.g) encoding for "¤" is 164 but the UTF8-Encoding for "¤" is: {194, 164} or in Trinary {"21012", "20002"}. The question mark means there is no valid UTF8 encoding given.
    As you can see in https://en.wikipedia.org/wiki/UTF-8 under the heading "Code point UTF-8 conversion" there are 2 bytes required for the character "¤" resp. &currenc resp. Ansi1252 = 164
    The assert should be

     Assert.That(source.FromTrinary("010210 010220 010221 010202 010222 010211 010221 010222 010222 010222 021012 020002 001101 001022 001020"), Is.EqualTo("fijekgjkkk¤%#!"));
    

    Please note the inserted 021012.

  • Custom User Avatar

    Hi!

    Sorry I'm slow to answer, been away for a while.

    The space was originally left in there intentionally, but I forgot to remove it when I decided to only have correct test inputs. I'll fix that right away.

    An emoji test would be fun, but I'd have to adjust my current solution before I do that!

    As for your solution, I'm not quite sure where it goes wrong. The decimal for ? is 63, the trinary would be 002100. The decimal for ¤ is 164, the trinary would be 020002. I can't see why your code confuse these two. I would suggest testing the code with different inputs and see where things stop working.

  • Custom User Avatar

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

  • Custom User Avatar

    I suggest adding test cases where the date of birth is exactly n years before the current date and is in a leap year

  • Custom User Avatar

    Best kata I've stumbled on !!

  • Custom User Avatar

    What a wonderful kata. After you solved it you will like it.

  • Custom User Avatar

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

  • Loading more items...