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.
subtle one
Why do you write such a "wide" code? It is hrad to read, please make some better structure. Good luck!
I have a preference for avoiding side effects in ternary expressions. I wonder if others would agree.
I edited the C++ test and clamped the value so that it's now less than
10000000
.Speaking of which, the test ranges for the random tests in different languages are all over the place. Some are
1-50
, then you have this.And still, the year after the issue is reported, the test engine of the site is not fixed, any you basically cannot earn points from this kata. Nice job guys.
Looks like the translation is already approved.
I don't get it too, lol
(deleted duplicate)
You are right.
The maximal value of an
unsigned int
on this machine is4294967295
. The next value forn=1804289383
is3*n+1 == 5412868150
which overflows and leaves1117900854
.The tests should not use numbers whose Collatz sequences contain members greater than
std::numeric_limits<unsigned int>::max()
, but I don't know how to compute such a limit.A first fix would be to limit the input numbers to a maximum of
1431655764
(== (std::numeric_limits<unsigned int>::max() - 1) / 3
).Indeed. There is no need for that complicated and obfuscated stuff.
I don't really get why this would be a best prectices too. The code is unreadable, complexity is usual, but there's an overhead of memory use.
Unreadable code, space it out a bit.
Hi
NickolasII
,i have fixed the tests. Can you try to submit your solution once again? Thanks!
Same issue with c++
Expected: [ -7.33, 48.67, -41.33 ]
Actual: [ -7.33, 48.67, -41.33 ]
Why is it considered best practice? You dont need another array for maximums.
Loading more items...