Ad
  • 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)).

  • 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

    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.

  • Default User Avatar

    Can avoid an extra (length > max_length) comparison by having the first check in the correct part of the while loop. My newer solution demonstrates this.

  • Default User Avatar

    Good use of the standard library. The conditional statement (in this case, ternary operator) is used in the right part of the code - for example, it would be bad practice to make only a single comparator function and make the comparator decide whether to return "greater than" or "less than" depending on d. Could avoid one-lining the comparator functions.

  • Default User Avatar

    Clever way to leverage the while condition to also decrement n. However, it's horrendous how you forced the code to fit in one line by omitting curly braces and eschewing common style patterns.

  • Default User Avatar

    Your site should allow downvoting kata solutions. Without downvoting, there is no active check against upvoting.

    If someone is able to come up with a solution, then it's great that they were able to solve the kata. However, I see solutions upvoted for "best practices" when they clearly lack actual good practices, such as proper indentation/spacing, early returns, and meaningful variable names. I also see solutions that take the naive approach (such as unnecessarily diving into nested loops instead of leveraging a mathematical formula), but they are upvoted for being "clever".

    If solutions are upvoted for "best practices" when they lack best practices, or upvoted for being "clever" when they are not clever, then new programmers will be misled into thinking that bad solutions are actually good. I have several years of professional experience, and I think that this site has a lot to offer to new programmers, so I look forward to seeing it grow. Once again, please allow downvoting kata solutions.