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 don't know how JIT would handle this. It's potentially less efficient if the filter constructs a different Array before proceeding... but if I cared about that level of performance I would probably not be using JavaScript to begin with. :)
When in doubt, favor readability over optimization. Knuth, BWK, and others will tell you premature optimization is the root of all evil.
Is performing a filter followed by a reduce less efficient than processing everything within a single reduce?
This is a 2 dimensionnal array.
First mapping, iterate each row (or line) and after mapping each row (or line), to change 'X' element to '*'
DRY
DRY not friendly
nice result, i totally forgot to DRY, thanks for the reminder
Worst time complexity solution, sorting and filter all the array element, so many iterations before get result ....
This comment is hidden because it contains spoiler information about the solution
I dont believe time complexity was good with this solution, because first you sort all array, and after, you check all number from first to last, you can do exactly the same thing without sorting input array (just wath behind solution). So i really think sorting is useless here.
This comment is hidden because it contains spoiler information about the solution
+1 not clever and not best practice
I don't think it was best practice because mutating original array is not a good practice
Code Duplication Warning
Return a new Array, but the original array is lost
+1 don't mutate original array
Loading more items...