Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
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.
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.
Pretty clean, without having to resort to regex dark wizardry. However, seems to dodge the problem's intent.
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)).
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.
A great example where knowing your math gets you an efficient solution.
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.
This comment is hidden because it contains spoiler information about the solution
Learned a lot from this, thank you :D
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.
good indentation and formatting style, tho
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.
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)
why are we using "size_t i" in for loop? can't we use "int i"?
Loading more items...