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
It's False. There are two
2
s and one3
so the correct array should beb = {4, 4, 9}
, where{2**2, 2**2, 3**2}
. Instructions below;Can you plz, explain what is the instruction missed here?
This comment is hidden because it contains spoiler information about the solution
True, very hard to catch especially i had this when using https://www.ehcache.org/ ! very hard to spot especially on production
Correction:
String.join
does use theStringBuilder
library, becauseStringJoiner
usesStringBuilder
under the hood. This means thatString.join
,StringJoiner
, andStringBuilder
are all O(n) optimal ways to concatenate strings, whereas the string concatenation operator+
is O(n^2).This comment is hidden because it contains spoiler information about the solution
nCopies just returns a cheap List that contains the repeated element as many times as specified. String::join doesn't even use a StringBuilder, instead it directly builds the char array for the resulting String. It should be hard to optimize further.
In any case, optimizing for speed at the design level would be premature optimization. In production code, I'd expect code that's easy to read and understand even if it's not fully optimized, except when it turns out to drag performance down.
i think you should comment about the nCopies underlying implementation i assume its stringbuilder ! but hard to rate the performance
for called methods from collections without proper knowing how its implemented