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.
I think so. Otherwise, that would be an integer division and the result would be incorrect.
1e6 is the computer notation for 10^6 = 1,000,000.
So, multiplying a number by 1e6, then rounding it (with int) and dividing it by 1e6, has the effect of rounding it to 6 decimals.
Sure, this code looks nice and short but string concatenation is terrible in term of performance...
For concatenating lots of string, never use +. Instead, prefer joins or a strings.Builder.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I wholeheartedly agree.
I don't think it's equivalent. The trailing spaces could be part of a string. In that case, having trailing spaces or not does matter.
Sorry but this is not clever at all. Unless you're trying to find the most expensive algorithm to get the result...
Thanks.
In fact, I think I've also been the only one to implement it purely functionnally (using only recursion and no mutation).
Usually yes but there can be exceptions. For this kata, I implemented each value as a singleton (I simulated lazy evaluation). So, in that case, the default equals is enough. But I've been the only one doing that. :p
I removed the Comparable interface that I previously added and it worked.
Thanks.
Hi,
What does the security test check? I'm passing everything but that.
Thanks.
Thanks. :)
Hi,
This code is certainly short but I wouldn't call it "best practice" nor "clever".
Its performance is disastrous. There are so many redundant/useless computations and use of extra memory...
For
range(10000, 20000)
, it takes forever while other solutions give the result instantly.Loading more items...