Ad
  • Custom User Avatar

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

  • Default User Avatar

    This is a good point. Random or not, a proper test set should have at least one test for each combination of input traits. Suppose the set of input traits is {hasHttp, hasHttps, hasWww, hasSLD, hasSubdomain, hasFilenameAtEnd}, where each trait is true or false. For all combinations of true and false values for those traits, the test set should include a URL that satisfies those traits.

  • Default User Avatar

    The instructions are terrible and do not fully describe the expected behavior. Sure, it could be argued that the solver shouldn't assume "http(s)://" will always be in the URL, even though all three examples have it, but I'm talking about stuff like what should be done about URL's such as "www.images.google.co.jp/". Should the solution return "images"? "images.google"? "google"?

    The instructions need a lot of work explaining the behavior of the solution, or at least fully characterizing the output of solutions.

  • Default User Avatar

    Pretty clean, without having to resort to regex dark wizardry. However, seems to dodge the problem's intent.

  • Default User Avatar

    This solution is O(n^2). I wasn't thinking properly when I used indexOf(). Check out my newer solution that simply sorts the two arrays and achieves O(nlog(n)).

  • Custom User Avatar

    I chose not to put the comparison there because, by doing that, it executes that instruction on every loop iteration, which immensely slows down the total run time. Although there are 2 more lines of code, the actualy number of times that comparison is made is much, much less.

  • Default User Avatar

    A great example where knowing your math gets you an efficient solution.

  • Default User Avatar

    Can someone remind me what's the proper way to make utility functions available to a class? I don't think "extends" (thus making CuboidVolumes a subclass of Cuboid) is the right way.

  • Default User Avatar

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

  • Default User Avatar

    Learned a lot from this, thank you :D

  • Default User Avatar

    Great demonstration of a bitfield, and clever use of the hexadecimal number as a mask to determine if any bit in the bitfield is 0.

  • Default User Avatar

    good indentation and formatting style, tho

  • Default User Avatar

    I was gonna say the same thing, and then I saw your BLESSED comment. This solution is good for code golf, but code golf itself doesn't have much of a place in industry.

  • Custom User Avatar

    You'll get a compiler warning when comparing the "int i" to "size_t arr_size".

    Default int is signed, while size_t is unsigned. In practice it won't matter until the arrays get very large (not tried in this kata)

  • Default User Avatar

    why are we using "size_t i" in for loop? can't we use "int i"?

  • Loading more items...