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.
https://learn.microsoft.com/en-gb/dotnet/standard/base-types/stringbuilder
i like it
the one and only solution
Thank you.
Such a graceful solution!
Where do you want to place
++i
?You're just out here providing high quality information for free brother 💞
"working on string" is slow if done incorrectly. Concatenation in a loop is an antipattern leading to performance issues, because it copies and recreates new string on every itetration.
Having said that, it should not be treated as any kind of guideline, because JS runtimes can (and do) perform some magic behind the scenes to improve performance. It can happen that concatenation in a loop will be optimized and transformed into some stringbuilder-ish equivalent.
Follow up reading: https://stackoverflow.com/questions/51185/are-javascript-strings-immutable-do-i-need-a-string-builder-in-javascript
Are Array operations faster than working on strings? I used string interpolation and a for loop to get the output. I tested my code and this code for table upto 10^6 numbers and this code was more performant by around 20-25% (using Performance interface).
'++i' would be the apex of elegance =D
Would have never thought of this..
Certainly clever, but I question the merit of using the index argument of array functions in cases where its value is not exactly the one required (and the one required must therefore be repeatedly derived). To me it seems like a needless addition of complexity that can be eliminated by simply settling for a traditional FOR-loop, permitting us to define precise initialization and termination points.
Granted, this example is so trivial, it hardly makes a difference either way.
i'm a fan
Just beutiful <3
otra alternativa válida es el uso del distinct
This comment is hidden because it contains spoiler information about the solution
Loading more items...