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.
Based on the author's solution, there seems to be an implicit assumption that whatever the size of the outer array, is also the size of each of the inner arrays. If this is the case, it needs to be explictized (and will probably invalidate some answers). All the current tests hardcode a length of 3, and the random tests of the Python translation hardcode the inner array size as 3. The description should be cleaned up to sort this out, as it makes adapting this Kata awkward into languages that support tuples or compile-time sized arrays because each person who adapts this Kata seems to make a different set of assumptions.
Oh neat I assumed
std::multiplies<void>
only had one template parameter like the regular version does. CoolIt should work with different types
template< class T = void >
struct multiplies;
(since C++14)
and the void version is the type deducing one
std::multiplies<void> is a specialization of std::multiplies with parameter and return type deduced.
This comment is hidden because it contains spoiler information about the solution
Yup, the updates do not change any part of the functionality at all. The changes just update the
assert equal
syntax in the fixed tests. The part of the random tests with the customized assertion messages was not touched whatsoever since I was already using the "newer" syntax because the older syntax doesn't allow you to customize messagesWould you please review this fork?
I think it looks reasonable, but I know nothing about C#, I don't feel confident to approve it myself, and this kata is peculiar and particular in its testing.
hi look
Translation Dart
n
should bestd::size_t
, notint
. This change would remove the need for the odd cast in theif
. Variables throughout your code that are supposed to represent an index or a size should bestd::size_t
private
section of theDescribe
struct, and keep the existing code in apublic
section. Here is an example#include
:<vector>
,<cstddef>
,<random>
(more on that below)ExtraMessage
. Many examples on how you can do so in this example suite<random>
instead. Link to the relevant docsconst std::vector<int>&
instead of by valuereturn {};
to the body of the solution setupTODO
comment on top of each snippet. It's bound to confuse some solversSince this Kata has been/will be adapted to languages where going out of bounds throws or invokes undefined behavior, the description should explicitly note that
n
can be larger than the array's size. It's 8kyu, so I think we should give the solvers some grace and have them pre-emptively handle edge cases instead of flying into exceptions or crashes.
approved by someone
Fork published
Fork of
eurydice5717
's translation that resolves this issue caused by overflow. Each call to generate a random value now constructs its own int distribution, removing the arithmetic and guaranteeing that the numbers are in range.Approved
LGTM! Approved. One minor quirk is that operations like
(disb(gen)%(extra/2))+1
return a lower bound that is one-less than the JS version (ex:1
here instead of2
). It infinitesimally increases the likelihood of integer divisions, but that seems harmless to me (since thefinite division
section in JS also generates integer divisions every now and then). If another reviewer finds this a deal breaker, it can be forkedLoading more items...