Ad
  • Custom User Avatar

    For anyone wondering, it's the quicksort algorithm. Thanks, this reminded me that it's easy enough to implement. :)

  • Custom User Avatar

    Done

  • Custom User Avatar

    Please add the following to InvalidCoordinates: "91.53525235,189.45235"
    I had a mistake which allowed longitude to go up to 189.xxxx and no test case broke.

  • Custom User Avatar

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

  • Custom User Avatar

    Ran into a random test case where the recipe required {'cocoa':0,...} and the expected result was then 0 (should be 31 if you ignored the cocoa).
    I think recipe[i] = Test.randomNumber(); causes the problem. I guess Test.randomNumber() can return 0.

  • Custom User Avatar

    IMO the right mindset is to solve problems as efficiently as possible. If the author wants to force us to use recursion, let them come up with a problem that absolutely requires recursion.

    Also, as far as I know, JavaScript doesn't do tail-call optimization, so recursion can run into the recursion-depth limit fairly quickly. With that in mind, I'd solve most recursion problems using loops anyway.

  • Custom User Avatar

    The 1st sample test case says 2048-07-01 should return True, but the closest date range is 2048-07-18 - 2048-10-25.
    According to my calculations 2048-07-01 is 40483 days away from 1937-8-30.

  • Custom User Avatar

    Fun problem but I found the description a bit hard to understand.

    Parts that confused me and suggestions:

    1. How come the group passes multiple times?

      Consider rephrasing this part as:

      A group can consist of many parts that are scattered across the parade, among parts of other groups. You want to see all the parts of your favorite group.

    2. Parts of the description refer to "float(s)" of a group. I found this confusing. Consider calling them "parts".

    3. So, we're busy and don't want to watch the full parade; we come and go so that we only watch our favorite group. But why do we always return to the same location and not move across the parade? At first read I got the impression that we'll move to different locations.

      Consider phrasing this as:

      The parade passes through the street where your house is. Your house is at number location of the street. You want to watch your favorite group from the balcony, but you don't want to watch the whole parade. The task is to figure out the times when you should go out to the balcony to see your group passing outside your house.